LCOV - code coverage report
Current view: top level - libreoffice/sd/source/filter/ppt - pptin.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 801 1444 55.5 %
Date: 2012-12-27 Functions: 16 19 84.2 %
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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <editeng/numitem.hxx>
      22             : 
      23             : #include <unotools/ucbstreamhelper.hxx>
      24             : #include <vcl/wrkwin.hxx>
      25             : #include <svl/urihelper.hxx>
      26             : #include <svx/svxids.hrc>
      27             : #include <filter/msfilter/svdfppt.hxx>
      28             : #include <svx/svditer.hxx>
      29             : #include <sfx2/docfile.hxx>
      30             : #include <sfx2/app.hxx>
      31             : #include <svx/svdograf.hxx>
      32             : #include <svx/svdlayer.hxx>
      33             : #include <vcl/msgbox.hxx>
      34             : #include <svl/style.hxx>
      35             : #include <svx/xflclit.hxx>
      36             : #include <editeng/eeitem.hxx>
      37             : #include <editeng/colritem.hxx>
      38             : #include <svl/whiter.hxx>
      39             : #include <svx/xgrad.hxx>
      40             : #include <svx/xflgrit.hxx>
      41             : #include <svx/xbtmpit.hxx>
      42             : #include <svx/xlnclit.hxx>
      43             : #include <editeng/adjitem.hxx>
      44             : #include <editeng/editeng.hxx>
      45             : #include <editeng/bulitem.hxx>
      46             : #include <editeng/lrspitem.hxx>
      47             : #include <editeng/lspcitem.hxx>
      48             : #include <editeng/tstpitem.hxx>
      49             : 
      50             : #include <sfx2/docinf.hxx>
      51             : 
      52             : #include "glob.hrc"
      53             : #include "pptin.hxx"
      54             : #include "Outliner.hxx"
      55             : #include "drawdoc.hxx"
      56             : #include "sdpage.hxx"
      57             : #include "sdresid.hxx"
      58             : #include "pres.hxx"
      59             : #include "stlpool.hxx"
      60             : #include "anminfo.hxx"
      61             : #include <svx/gallery.hxx>
      62             : #include <tools/urlobj.hxx>
      63             : #include <svl/itempool.hxx>
      64             : #include <editeng/fhgtitem.hxx>
      65             : #include <svx/svdopage.hxx>
      66             : #include <svx/svdomedia.hxx>
      67             : #include <svx/svdogrp.hxx>
      68             : #include "propread.hxx"
      69             : #include <cusshow.hxx>
      70             : #include <vcl/bmpacc.hxx>
      71             : #include "customshowlist.hxx"
      72             : 
      73             : #include "../../ui/inc/DrawDocShell.hxx"
      74             : #include "../../ui/inc/FrameView.hxx"
      75             : #include "../../ui/inc/optsitem.hxx"
      76             : 
      77             : #include <unotools/fltrcfg.hxx>
      78             : #include <sfx2/progress.hxx>
      79             : #include <unotools/localfilehelper.hxx>
      80             : #include <editeng/editstat.hxx>
      81             : #include <unotools/pathoptions.hxx>
      82             : #include <sfx2/docfac.hxx>
      83             : #define MAX_USER_MOVE       2
      84             : 
      85             : #include "pptinanimations.hxx"
      86             : #include "ppt97animations.hxx"
      87             : 
      88             : #include <com/sun/star/document/XDocumentProperties.hpp>
      89             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      90             : 
      91             : #include <comphelper/string.hxx>
      92             : #include <oox/ole/olehelper.hxx>
      93             : 
      94             : using namespace ::com::sun::star;
      95             : 
      96           6 : SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium )
      97             : {
      98             : 
      99           6 :     sal_uInt32 nImportFlags = 0;
     100             : 
     101             : #ifdef DBG_UTIL
     102             :     PropRead* pSummaryInformation = new PropRead( rStorage, String( "\005SummaryInformation"  ) );
     103             :     if ( pSummaryInformation->IsValid() )
     104             :     {
     105             :         pSummaryInformation->Read();
     106             :         sal_uInt8 aPropSetGUID[ 16 ] =
     107             :         {
     108             :             0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9
     109             :         };
     110             :         Section* pSection = (Section*)pSummaryInformation->GetSection( aPropSetGUID );
     111             :         if ( pSection )
     112             :         {
     113             :             PropItem aPropItem;
     114             :             if ( pSection->GetProperty( PID_COMMENTS, aPropItem ) )
     115             :             {
     116             :                 String aComment;
     117             :                 aPropItem.Read( aComment );
     118             :                 if ( aComment.Search( String( "Applixware"  ), 0 ) != STRING_NOTFOUND )
     119             :                 {
     120             :                     nImportFlags |= PPT_IMPORTFLAGS_NO_TEXT_ASSERT;
     121             :                 }
     122             :             }
     123             :         }
     124             :     }
     125             :     delete pSummaryInformation;
     126             : #endif
     127             : 
     128           6 :     PowerPointImportParam aParam( rDocStream, nImportFlags );
     129           6 :     SvStream* pCurrentUserStream = rStorage.OpenSotStream( rtl::OUString( "Current User" ), STREAM_STD_READ );
     130           6 :     if( pCurrentUserStream )
     131             :     {
     132           6 :         *pCurrentUserStream >> aParam.aCurrentUserAtom;
     133           6 :         delete pCurrentUserStream;
     134             :     }
     135             : 
     136           6 :     if( pDocument )
     137             :     {
     138             :         // iterate over all styles
     139           6 :         SdStyleSheetPool* pStyleSheetPool = pDocument->GetSdStyleSheetPool();
     140             : 
     141           6 :         sal_uInt32 nStyles = pStyleSheetPool ? pStyleSheetPool->GetStyles().size() : 0;
     142         468 :         for (sal_uInt32 nStyle = 0; nStyle < nStyles; nStyle++)
     143             :         {
     144         462 :             SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pStyleSheetPool->GetStyles()[nStyle].get() );
     145         462 :             SfxItemSet& rSet = pSheet->GetItemSet();
     146             : 
     147             :             // if autokerning is set in style, override it, ppt has no autokerning
     148         462 :             if( rSet.GetItemState( EE_CHAR_PAIRKERNING, sal_False ) == SFX_ITEM_SET )
     149          48 :                 rSet.ClearItem( EE_CHAR_PAIRKERNING );
     150             :         }
     151             :     }
     152             : 
     153           6 :     pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
     154           6 : }
     155             : 
     156           6 : sal_Bool SdPPTImport::Import()
     157             : {
     158           6 :     return pFilter->Import();
     159             : }
     160             : 
     161           6 : SdPPTImport::~SdPPTImport()
     162             : {
     163           6 :     delete pFilter;
     164           6 : }
     165             : 
     166           6 : ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SvStorage& rStorage_, SfxMedium& rMedium, PowerPointImportParam& rParam )
     167             : :   SdrPowerPointImport     ( rParam, rMedium.GetBaseURL() )
     168             : ,   mrMed                   ( rMedium )
     169             : ,   mrStorage               ( rStorage_ )
     170             : ,   mbDocumentFound         ( sal_False )
     171           6 : ,   mnFilterOptions         ( 0 )
     172             : {
     173           6 :     mpDoc = pDocument;
     174           6 :     if ( bOk )
     175             :     {
     176           5 :         mbDocumentFound = SeekToDocument( &maDocHd );                           // maDocHd = the latest DocumentHeader
     177          10 :         while ( SeekToRec( rStCtrl, PPT_PST_Document, nStreamLen, &maDocHd ) )
     178           0 :             mbDocumentFound = sal_True;
     179             : 
     180           5 :         sal_uInt32 nDggContainerOfs = 0;
     181             : 
     182           5 :         if ( mbDocumentFound )
     183             :         {
     184           5 :             sal_uLong nPosMerk = rStCtrl.Tell();
     185             : 
     186           5 :             pStData = rStorage_.OpenSotStream( rtl::OUString( "Pictures" ), STREAM_STD_READ );
     187             : 
     188           5 :             rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
     189           5 :             sal_uLong nDocLen = maDocHd.GetRecEndFilePos();
     190           5 :             DffRecordHeader aPPDGHd;
     191           5 :             if ( SeekToRec( rStCtrl, PPT_PST_PPDrawingGroup, nDocLen, &aPPDGHd ) )
     192             :             {
     193           5 :                 sal_uLong nPPDGLen = aPPDGHd.GetRecEndFilePos();
     194           5 :                 if ( SeekToRec( rStCtrl, DFF_msofbtDggContainer, nPPDGLen, NULL ) )
     195           5 :                     nDggContainerOfs = rStCtrl.Tell();
     196             :             }
     197           5 :             rStCtrl.Seek( nPosMerk );
     198             :         }
     199           5 :         sal_uInt32 nSvxMSDffOLEConvFlags2 = 0;
     200             : 
     201           5 :         const SvtFilterOptions& rBasOpt = SvtFilterOptions::Get();
     202           5 :         if ( rBasOpt.IsLoadPPointBasicCode() )
     203           5 :             mnFilterOptions |= 1;
     204           5 :         if ( rBasOpt.IsMathType2Math() )
     205           5 :             nSvxMSDffOLEConvFlags2 |= OLE_MATHTYPE_2_STARMATH;
     206           5 :         if ( rBasOpt.IsWinWord2Writer() )
     207           5 :             nSvxMSDffOLEConvFlags2 |= OLE_WINWORD_2_STARWRITER;
     208           5 :         if ( rBasOpt.IsExcel2Calc() )
     209           5 :             nSvxMSDffOLEConvFlags2 |= OLE_EXCEL_2_STARCALC;
     210           5 :         if ( rBasOpt.IsPowerPoint2Impress() )
     211           5 :             nSvxMSDffOLEConvFlags2 |= OLE_POWERPOINT_2_STARIMPRESS;
     212             : 
     213           5 :         InitSvxMSDffManager( nDggContainerOfs, pStData, nSvxMSDffOLEConvFlags2 );
     214             :         SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS
     215           5 :             | SVXMSDFF_SETTINGS_IMPORT_PPT );
     216           5 :         SetModel( mpDoc, 576 );
     217             :     }
     218           6 : }
     219             : 
     220             : //////////////////////////////////////////////////////////////////////////
     221             : //
     222             : // Dtor
     223             : //
     224             : //////////////////////////////////////////////////////////////////////////
     225             : 
     226          18 : ImplSdPPTImport::~ImplSdPPTImport()
     227             : {
     228           6 :     delete pStData;
     229          12 : }
     230             : 
     231             : //////////////////////////////////////////////////////////////////////////
     232             : //
     233             : // Import
     234             : //
     235             : //////////////////////////////////////////////////////////////////////////
     236             : 
     237           6 : sal_Bool ImplSdPPTImport::Import()
     238             : {
     239           6 :     if ( !bOk )
     240           1 :         return sal_False;
     241             : 
     242           5 :     pSdrModel->setLock(true);
     243           5 :     pSdrModel->EnableUndo(false);
     244             : 
     245           5 :     SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
     246           5 :     sal_uInt32 nControlWord = rOutl.GetEditEngine().GetControlWord();
     247           5 :     nControlWord |=  EE_CNTRL_ULSPACESUMMATION;
     248           5 :     nControlWord &=~ EE_CNTRL_ULSPACEFIRSTPARA;
     249           5 :     ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
     250             : 
     251           5 :     SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
     252           5 :     mnBackgroundLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False );
     253           5 :     mnBackgroundObjectsLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False );
     254             : 
     255           5 :     ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
     256           5 :     if ( pDocShell )
     257           5 :         SeekOle( pDocShell, mnFilterOptions );
     258             : 
     259             :     // hyperlinks
     260           5 :     PropRead* pDInfoSec2 = new PropRead( mrStorage, rtl::OUString( "\005DocumentSummaryInformation" ) );
     261           5 :     if ( pDInfoSec2->IsValid() )
     262             :     {
     263           5 :         PropItem aPropItem;
     264             : 
     265             :         sal_uInt32 nType, nPropSize, nPropCount;
     266             : 
     267           5 :         pDInfoSec2->Read();
     268             : 
     269             :         sal_uInt8 aPropSetGUID[ 16 ] =
     270             :         {
     271             :             0x02, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
     272           5 :         };
     273           5 :         Section* pSection = (Section*)pDInfoSec2->GetSection( aPropSetGUID );
     274           5 :         if ( pSection )
     275             :         {
     276           5 :             if ( pSection->GetProperty( PID_SLIDECOUNT, aPropItem ) )
     277             :             {
     278           2 :                 aPropItem >> nType;
     279           2 :                 if ( ( nType == VT_I4 ) || ( nType == VT_UI4 ) )
     280             :                 {
     281             :                     // examine PID_HEADINGPAIR to get the correct entry for PID_DOCPARTS
     282             :                     sal_uInt32 nSlideCount, nVecCount;
     283           2 :                     aPropItem >> nSlideCount;
     284           2 :                     if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
     285             :                     {
     286           2 :                         sal_uInt32  nSlideTitleIndex = 0, nSlideTitleCount = 0;
     287             :                         sal_uInt32  i, nTemp;
     288             : 
     289           2 :                         String aUString;
     290             : 
     291           2 :                         aPropItem >> nType
     292           2 :                                   >> nVecCount;
     293             : 
     294           2 :                         if ( ( nType == ( VT_VARIANT | VT_VECTOR ) ) && ( nVecCount ^ 1 ) )
     295             :                         {
     296           2 :                             nVecCount >>= 1;
     297           2 :                             sal_uInt32 nEntryCount = 0;
     298           8 :                             for ( i = 0; i < nVecCount; i++ )
     299             :                             {
     300           6 :                                 if ( !aPropItem.Read( aUString, VT_EMPTY, sal_False ) )
     301           0 :                                     break;
     302           6 :                                 aPropItem >> nType;
     303           6 :                                 if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
     304           0 :                                     break;
     305           6 :                                 aPropItem >> nTemp;
     306           6 :                                 if ( aUString.EqualsAscii("Slide Titles") || aUString.EqualsAscii("Folientitel") )
     307             :                                 {
     308           0 :                                     nSlideTitleCount = nTemp;
     309           0 :                                     nSlideTitleIndex = nEntryCount;
     310             :                                 }
     311           6 :                                 nEntryCount += nTemp;
     312             :                             }
     313             :                         }
     314           2 :                         if ( ( nSlideCount == nSlideTitleCount ) && pSection->GetProperty( PID_DOCPARTS, aPropItem ) )
     315             :                         {
     316           0 :                             aPropItem >> nType
     317           0 :                                       >> nVecCount;
     318             : 
     319           0 :                             if ( ( nVecCount >= ( nSlideTitleIndex + nSlideTitleCount ) )
     320             :                                     && ( nType == ( VT_LPSTR | VT_VECTOR ) ) )
     321             :                             {
     322           0 :                                 for ( i = 0; i != nSlideTitleIndex; i++ )
     323             :                                 {
     324           0 :                                     aPropItem >> nTemp;
     325           0 :                                     aPropItem.SeekRel( nTemp );
     326             :                                 }
     327           0 :                                 for ( i = 0; i < nSlideTitleCount; i++ )
     328             :                                 {
     329           0 :                                     if ( !aPropItem.Read( aUString, nType, sal_False ) )
     330             :                                         break;
     331             : 
     332           0 :                                     String aString( aUString );
     333           0 :                                     if ( aString.EqualsAscii( "No Slide Title" ))
     334           0 :                                         aString = String();
     335             :                                     else
     336             :                                     {
     337             :                                         std::vector<String>::const_iterator pIter =
     338           0 :                                                 std::find(maSlideNameList.begin(),maSlideNameList.end(),aString);
     339             : 
     340           0 :                                         if (pIter != maSlideNameList.end())
     341           0 :                                             aString = String();
     342             :                                     }
     343           0 :                                     maSlideNameList.push_back( aString );
     344           0 :                                 }
     345             :                             }
     346           2 :                         }
     347             :                     }
     348             :                 }
     349             :             }
     350             : 
     351             :             sal_uInt8 aUserPropSetGUID[ 16 ] =
     352             :             {
     353             :                 0x05, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
     354           5 :             };
     355           5 :             pSection = (Section*)pDInfoSec2->GetSection( aUserPropSetGUID );
     356           5 :             if ( pSection )
     357             :             {
     358           3 :                 Dictionary aDict;
     359           3 :                 if ( pSection->GetDictionary( aDict ) )
     360             :                 {
     361           3 :                     Dictionary::const_iterator iter = aDict.find( rtl::OUString("_PID_HLINKS") );
     362             : 
     363           3 :                     if ( iter != aDict.end() )
     364             :                     {
     365           0 :                         if ( pSection->GetProperty( iter->second, aPropItem ) )
     366             :                         {
     367           0 :                             aPropItem.Seek( STREAM_SEEK_TO_BEGIN );
     368           0 :                             aPropItem >> nType;
     369           0 :                             if ( nType == VT_BLOB )
     370             :                             {
     371           0 :                                 aPropItem >> nPropSize
     372           0 :                                           >> nPropCount;
     373             : 
     374           0 :                                 if ( ! ( nPropCount % 6 ) )
     375             :                                 {
     376             :                                     sal_uInt32 i;
     377             : 
     378           0 :                                     nPropCount /= 6;    // 6 propertys a hyperlink
     379             : 
     380           0 :                                     SdHyperlinkEntry* pHyperlink = 0;
     381           0 :                                     for ( i = 0; i < nPropCount; i++ )
     382             :                                     {
     383           0 :                                         pHyperlink = new SdHyperlinkEntry;
     384           0 :                                         pHyperlink->nIndex = 0;
     385           0 :                                         aPropItem >> nType;
     386           0 :                                         if ( nType != VT_I4 )
     387             :                                             break;
     388           0 :                                         aPropItem >> pHyperlink->nPrivate1
     389           0 :                                                   >> nType;
     390           0 :                                         if ( nType != VT_I4 )
     391             :                                             break;
     392           0 :                                         aPropItem >> pHyperlink->nPrivate2
     393           0 :                                                   >> nType;
     394           0 :                                         if ( nType != VT_I4 )
     395             :                                             break;
     396           0 :                                         aPropItem >> pHyperlink->nPrivate3
     397           0 :                                                   >> nType;
     398           0 :                                         if ( nType != VT_I4 )
     399             :                                             break;
     400           0 :                                         aPropItem >> pHyperlink->nInfo;
     401           0 :                                         if ( !aPropItem.Read( pHyperlink->aTarget, VT_EMPTY ) )
     402             :                                             break;
     403             : 
     404             :                                         // Convert '\\' notation to 'smb://'
     405           0 :                                         INetURLObject aUrl( pHyperlink->aTarget, INET_PROT_FILE );
     406           0 :                                         pHyperlink->aTarget = aUrl.GetMainURL( INetURLObject::NO_DECODE );
     407             : 
     408           0 :                                         if ( !aPropItem.Read( pHyperlink->aSubAdress, VT_EMPTY ) )
     409             :                                             break;
     410           0 :                                         pHyperlink->nStartPos = pHyperlink->nEndPos = -1;
     411             : 
     412           0 :                                         if ( pHyperlink->aSubAdress.Len() ) // get the converted subadress
     413             :                                         {
     414           0 :                                             sal_uInt32 nPageNumber = 0;
     415           0 :                                             String aString( pHyperlink->aSubAdress );
     416           0 :                                             rtl::OString aStringAry[ 3 ];
     417           0 :                                             sal_uInt16 nTokenCount = comphelper::string::getTokenCount(aString, ',');
     418           0 :                                             if ( nTokenCount > 3 )
     419           0 :                                                 nTokenCount = 3;
     420             :                                             sal_uInt16 nToken;
     421           0 :                                             for( nToken = 0; nToken < nTokenCount; nToken++ )
     422           0 :                                                 aStringAry[nToken] = rtl::OUStringToOString(aString.GetToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8);
     423             : 
     424           0 :                                             sal_Bool bSucceeded = sal_False;
     425             : 
     426             :                                             // first pass, searching for a SlideId
     427           0 :                                             for( nToken = 0; nToken < nTokenCount; nToken++ )
     428             :                                             {
     429           0 :                                                 if (comphelper::string::isdigitAsciiString(aStringAry[nToken]))
     430             :                                                 {
     431           0 :                                                     sal_Int32 nNumber = aStringAry[ nToken ].toInt32();
     432           0 :                                                     if ( nNumber & ~0xff )
     433             :                                                     {
     434           0 :                                                         PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
     435           0 :                                                         if ( pPageList )
     436             :                                                         {
     437           0 :                                                             sal_uInt16 nPage = pPageList->FindPage( nNumber );
     438           0 :                                                             if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
     439             :                                                             {
     440           0 :                                                                 nPageNumber = nPage;
     441           0 :                                                                 bSucceeded = sal_True;
     442           0 :                                                                 break;
     443             :                                                             }
     444             :                                                         }
     445             :                                                     }
     446             :                                                 }
     447             :                                             }
     448           0 :                                             if ( !bSucceeded )
     449             :                                             {   // second pass, searching for a SlideName
     450           0 :                                                 for ( nToken = 0; nToken < nTokenCount; nToken++ )
     451             :                                                 {
     452           0 :                                                     String aToken( aString.GetToken( nToken, (sal_Unicode)',' ) );
     453             :                                                     std::vector<String>::const_iterator pIter =
     454           0 :                                                             std::find(maSlideNameList.begin(),maSlideNameList.end(),aToken);
     455             : 
     456           0 :                                                     if (pIter != maSlideNameList.end())
     457             :                                                     {
     458           0 :                                                         nPageNumber = pIter - maSlideNameList.begin();
     459           0 :                                                         bSucceeded = sal_True;
     460             :                                                     }
     461           0 :                                                 }
     462             :                                             }
     463           0 :                                             if ( !bSucceeded )
     464             :                                             {   // third pass, searching for a slide number
     465           0 :                                                 for ( nToken = 0; nToken < nTokenCount; nToken++ )
     466             :                                                 {
     467           0 :                                                     if (comphelper::string::isdigitAsciiString(aStringAry[nToken]))
     468             :                                                     {
     469           0 :                                                         sal_Int32 nNumber = aStringAry[ nToken ].toInt32();
     470           0 :                                                         if ( ( nNumber & ~0xff ) == 0 )
     471             :                                                         {
     472           0 :                                                             nPageNumber = (sal_uInt32)nNumber - 1;
     473           0 :                                                             bSucceeded = sal_True;
     474           0 :                                                             break;
     475             :                                                         }
     476             :                                                     }
     477             :                                                 }
     478             :                                             }
     479           0 :                                             if ( bSucceeded )
     480             :                                             {
     481           0 :                                                 if ( nPageNumber < maSlideNameList.size() )
     482           0 :                                                     pHyperlink->aConvSubString = maSlideNameList[ nPageNumber ];
     483           0 :                                                 if ( !pHyperlink->aConvSubString.Len() )
     484             :                                                 {
     485           0 :                                                     pHyperlink->aConvSubString = String( SdResId( STR_PAGE ) );
     486           0 :                                                     pHyperlink->aConvSubString.Append( sal_Unicode( ' ' ) );
     487           0 :                                                     pHyperlink->aConvSubString.Append( mpDoc->CreatePageNumValue( (sal_uInt16)nPageNumber + 1 ) );
     488             :                                                 }
     489           0 :                                             }
     490             :                                         }
     491           0 :                                         aHyperList.push_back( pHyperlink );
     492           0 :                                     }
     493           0 :                                     if ( i != nPropCount )
     494           0 :                                         delete pHyperlink;
     495             :                                 }
     496             :                             }
     497             :                         }
     498             :                     }
     499           3 :                 }
     500             :             }
     501           5 :         }
     502             :     }
     503           5 :     delete pDInfoSec2;
     504             : 
     505           5 :     if ( mbDocumentFound )
     506             :     {
     507           5 :         rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
     508             :         // HyperList lesen / Indexe der einzelnen Eintraege setzen
     509           5 :         DffRecordHeader aHyperHd;
     510           5 :         if ( SeekToRec( rStCtrl, PPT_PST_ExObjList, maDocHd.GetRecEndFilePos(), &aHyperHd ) )
     511             :         {
     512           3 :             sal_uInt32 nExObjHyperListLen = aHyperHd.GetRecEndFilePos();
     513           3 :             for ( size_t i = 0, n = aHyperList.size(); i < n; ++i )
     514             :             {
     515           0 :                 SdHyperlinkEntry* pPtr = aHyperList[ i ];
     516           0 :                 DffRecordHeader aHyperE;
     517           0 :                 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlink, nExObjHyperListLen, &aHyperE ) )
     518             :                     break;
     519           0 :                 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlinkAtom, nExObjHyperListLen, NULL, 0 ) )
     520             :                     break;
     521           0 :                 rStCtrl.SeekRel( 8 );
     522           0 :                 rStCtrl >> pPtr->nIndex;
     523           0 :                 aHyperE.SeekToEndOfRecord( rStCtrl );
     524             :             }
     525             :         }
     526             :     }
     527             : 
     528           5 :     Size aVisAreaSize;
     529           5 :     switch ( aUserEditAtom.eLastViewType )
     530             :     {
     531             :         case 5 :    // notes master
     532             :         case 3 :    // notes
     533           0 :             aVisAreaSize = aDocAtom.GetNotesPageSize();
     534           0 :         break;
     535             :         default :
     536           5 :             aVisAreaSize = aDocAtom.GetSlidesPageSize();
     537             :     }
     538           5 :     Scale( aVisAreaSize );
     539           5 :     pDocShell->SetVisArea( Rectangle( Point(), aVisAreaSize ) );
     540             : 
     541             :     ///////////////////////////////////////////////////////////
     542             :     // create master pages:
     543             :     ///////////////////////////////////////////////////////////
     544             :     SfxProgress* pStbMgr = new SfxProgress( pDocShell, String( SdResId( STR_POWERPOINT_IMPORT ) ),
     545           5 :             pMasterPages->size() + pSlidePages->size() + pNotePages->size() );
     546             : 
     547           5 :     sal_uInt32 nImportedPages = 0;
     548             :     {
     549           5 :         sal_uInt16          nMasterAnz = GetPageCount( PPT_MASTERPAGE );
     550             : 
     551          20 :         for ( sal_uInt16 nMasterNum = 0; nMasterNum < nMasterAnz; nMasterNum++ )
     552             :         {
     553          15 :             SetPageNum( nMasterNum, PPT_MASTERPAGE );
     554          15 :             SdPage* pPage = (SdPage*)MakeBlancPage( sal_True );
     555          15 :             if ( pPage )
     556             :             {
     557          15 :                 sal_Bool bNotesMaster = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bNotesMaster;
     558          15 :                 sal_Bool bStarDrawFiller = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bStarDrawFiller;
     559             : 
     560          15 :                 PageKind ePgKind = ( bNotesMaster ) ? PK_NOTES : PK_STANDARD;
     561          15 :                 pPage->SetPageKind( ePgKind );
     562          15 :                 pSdrModel->InsertMasterPage( (SdrPage*)pPage );
     563          15 :                 if ( bNotesMaster && bStarDrawFiller )
     564           1 :                     ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_NOTES, sal_True );
     565          15 :                 if ( nMasterNum )
     566             :                 {
     567          10 :                     boost::optional< sal_Int16 > oStartNumbering;
     568             :                     SfxStyleSheet* pSheet;
     569          10 :                     if ( nMasterNum == 1 )
     570             :                     {
     571             :                         ///////////////////
     572             :                         // standardsheet //
     573             :                         ///////////////////
     574           5 :                         pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
     575           5 :                         if ( pSheet )
     576             :                         {
     577           5 :                             SfxItemSet& rItemSet = pSheet->GetItemSet();
     578           5 :                             PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
     579           5 :                             PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
     580           5 :                             aParagraph.AppendPortion( aPortion );
     581           5 :                             aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
     582           5 :                             aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
     583             :                         }
     584             :                     }
     585             : 
     586             :                     // PSEUDO
     587          10 :                     pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
     588          10 :                     if ( pSheet )
     589             :                     {
     590          10 :                         SfxItemSet& rItemSet = pSheet->GetItemSet();
     591          10 :                         PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
     592          10 :                         PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
     593          10 :                         aParagraph.AppendPortion( aPortion );
     594          10 :                         aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
     595          10 :                         aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
     596             :                     }
     597             : 
     598             :                     ///////////////////////////////////////////////////////////
     599             :                     // create layoutstylesheets, set layoutname and stylesheet
     600             :                     // (nur auf Standard- und Notizseiten)
     601             :                     ///////////////////////////////////////////////////////////
     602          10 :                     String aLayoutName( SdResId( STR_LAYOUT_DEFAULT_NAME ) );
     603          10 :                     if ( nMasterNum > 2 )
     604             :                     {
     605           0 :                         if ( ePgKind == PK_STANDARD )
     606             :                         {   // Standardseite: Neues Praesentationslayout erzeugen
     607           0 :                             aLayoutName = String( SdResId( STR_LAYOUT_DEFAULT_TITLE_NAME ) );
     608           0 :                             aLayoutName += String::CreateFromInt32( (sal_Int32)( ( nMasterNum + 1 ) / 2 - 1 ) );
     609           0 :                             ( (SdStyleSheetPool*)mpDoc->GetStyleSheetPool() )->CreateLayoutStyleSheets( aLayoutName );
     610             :                         }
     611             :                         else    // Notizseite: Praesentationslayout von der Standardseite verwenden
     612           0 :                             aLayoutName = ( (SdPage*)mpDoc->GetMasterPage( nMasterNum - 1 ) )->GetName();
     613             :                     }
     614          10 :                     pPage->SetName( aLayoutName );
     615          10 :                     aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
     616          10 :                     aLayoutName += String( SdResId( STR_LAYOUT_OUTLINE ) );
     617          10 :                     pPage->SetLayoutName( aLayoutName );
     618             : 
     619             :                     /////////////////////
     620             :                     // set stylesheets //
     621             :                     /////////////////////
     622          10 :                     if ( pPage->GetPageKind() == PK_STANDARD )
     623             :                     {
     624           5 :                         sal_uInt32 nTitleInstance = TSS_TYPE_PAGETITLE;
     625           5 :                         sal_uInt32 nOutlinerInstance = TSS_TYPE_BODY;
     626             : 
     627             :                         /////////////////////
     628             :                         // titelstylesheet //
     629             :                         /////////////////////
     630           5 :                         pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
     631           5 :                         if ( pSheet )
     632             :                         {
     633           5 :                             SfxItemSet& rItemSet = pSheet->GetItemSet();
     634           5 :                             PPTParagraphObj aParagraph( *pPPTStyleSheet, nTitleInstance, 0 );
     635           5 :                             PPTPortionObj aPortion( *pPPTStyleSheet, nTitleInstance, 0 );
     636           5 :                             aParagraph.AppendPortion( aPortion );
     637           5 :                             aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
     638           5 :                             aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
     639             :                         }
     640             :                         ////////////////////////
     641             :                         // outlinerstylesheet //
     642             :                         ////////////////////////
     643             :                         sal_uInt16 nLevel;
     644             :                         PPTParagraphObj* pParagraphs[ 9 ];
     645           5 :                         PPTParagraphObj* pPreviousPara = NULL;
     646             : 
     647          50 :                         for ( nLevel = 0; nLevel < 9; nLevel++ )
     648             :                         {
     649          45 :                             String aName( pPage->GetLayoutName() );
     650          45 :                             aName.Append( (sal_Unicode)( ' ' ) );
     651          45 :                             aName.Append( String::CreateFromInt32( nLevel + 1 ) );
     652          45 :                             SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
     653             :                             DBG_ASSERT( pOutlineSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden" );
     654          45 :                             if ( pOutlineSheet )
     655             :                             {
     656          45 :                                 pParagraphs[ nLevel ] = new PPTParagraphObj( *pPPTStyleSheet, nOutlinerInstance, nLevel );
     657          45 :                                 SfxItemSet& rItemSet = pOutlineSheet->GetItemSet();
     658          45 :                                 PPTPortionObj aPortion( *pPPTStyleSheet, nOutlinerInstance, nLevel );
     659          45 :                                 pParagraphs[ nLevel ]->AppendPortion( aPortion );
     660          45 :                                 pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, pPreviousPara );
     661          45 :                                 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
     662          45 :                                 pPreviousPara = pParagraphs[ nLevel ];
     663             :                             }
     664             :                             else
     665           0 :                                 pParagraphs[ nLevel ] = NULL;
     666          45 :                         }
     667           5 :                         for ( nLevel = 0; nLevel < 9; delete pParagraphs[ nLevel++ ] ) ;
     668             :                         /////////////////////////
     669             :                         // subtitle stylesheet //
     670             :                         /////////////////////////
     671           5 :                         pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
     672           5 :                         if ( pSheet )
     673             :                         {
     674           5 :                             SfxItemSet& rItemSet = pSheet->GetItemSet();
     675           5 :                             PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
     676           5 :                             PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
     677           5 :                             aParagraph.AppendPortion( aPortion );
     678           5 :                             aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
     679           5 :                             aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
     680             :                         }
     681             :                     }
     682           5 :                     else if ( ePgKind == PK_NOTES )
     683             :                     {
     684           5 :                         pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
     685           5 :                         if ( pSheet )
     686             :                         {
     687           5 :                             SfxItemSet& rItemSet = pSheet->GetItemSet();
     688           5 :                             PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
     689           5 :                             PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
     690           5 :                             aParagraph.AppendPortion( aPortion );
     691           5 :                             aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
     692           5 :                             aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
     693             :                         }
     694          10 :                     }
     695             :                 }
     696             :             }
     697             :         }
     698             :     }
     699             :     SdPage* pMPage;
     700             :     sal_uInt16 i;
     701          15 :     for ( i = 1; i < mpDoc->GetMasterPageCount() && ( (pMPage = (SdPage*)mpDoc->GetMasterPage( i )) != 0 ); i++ )
     702             :     {
     703          10 :         SetPageNum( i, PPT_MASTERPAGE );
     704             :         /////////////////////////////////////////////
     705             :         // importing master page objects           //
     706             :         /////////////////////////////////////////////
     707          10 :         PptSlidePersistList* pList = GetPageList( eAktPageKind );
     708          10 :         PptSlidePersistEntry* pPersist = ( pList && ( nAktPageNum < pList->size() ) )
     709          20 :                                                     ? (*pList)[ nAktPageNum ] : NULL;
     710          10 :         if ( pPersist )
     711             :         {
     712          10 :             if ( pPersist->bStarDrawFiller && pPersist->bNotesMaster && ( nAktPageNum > 2 ) && ( ( nAktPageNum & 1 ) == 0 ) )
     713             :             {
     714           0 :                 pSdrModel->DeleteMasterPage( nAktPageNum );
     715           0 :                 SdrPage* pNotesClone = ((SdPage*)pSdrModel->GetMasterPage( 2 ))->Clone();
     716           0 :                 pSdrModel->InsertMasterPage( pNotesClone, nAktPageNum );
     717           0 :                 if ( pNotesClone )
     718             :                 {
     719           0 :                     String aLayoutName( ((SdPage*)pSdrModel->GetMasterPage( nAktPageNum - 1 ))->GetLayoutName() );
     720           0 :                     ((SdPage*)pNotesClone)->SetPresentationLayout( aLayoutName, sal_False, sal_False, sal_False );
     721           0 :                     ((SdPage*)pNotesClone)->SetLayoutName( aLayoutName );
     722           0 :                 }
     723             :             }
     724          10 :             else if ( pPersist->bStarDrawFiller == sal_False )
     725             :             {
     726           9 :                 PptSlidePersistEntry* pE = pPersist;
     727          18 :                 while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
     728             :                 {
     729           0 :                     sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
     730           0 :                     if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
     731           0 :                         break;
     732             :                     else
     733           0 :                         pE = (*pList)[ nNextMaster ];
     734             :                 }
     735           9 :                 SdrObject* pObj = ImportPageBackgroundObject( *pMPage, pE->nBackgroundOffset, sal_True );   // import background
     736           9 :                 if ( pObj )
     737           9 :                     pMPage->NbcInsertObject( pObj );
     738             : 
     739           9 :                 sal_Bool bNewAnimationsUsed = sal_False;
     740           9 :                 ProcessData aProcessData( *(*pList)[ nAktPageNum ], (SdPage*)pMPage );
     741           9 :                 sal_uInt32 nFPosMerk = rStCtrl.Tell();
     742           9 :                 DffRecordHeader aPageHd;
     743           9 :                 if ( SeekToAktPage( &aPageHd ) )
     744             :                 {
     745         124 :                     while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
     746             :                     {
     747         106 :                         DffRecordHeader aHd;
     748         106 :                          rStCtrl >> aHd;
     749         106 :                         switch( aHd.nRecType )
     750             :                         {
     751             :                             case PPT_PST_PPDrawing :
     752             :                             {
     753           9 :                                 aHd.SeekToBegOfRecord( rStCtrl );
     754           9 :                                 DffRecordHeader aPPDrawHd;
     755           9 :                                 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
     756             :                                 {
     757           9 :                                     sal_uInt32 nPPDrawEnd = aPPDrawHd.GetRecEndFilePos();
     758           9 :                                     DffRecordHeader aEscherF002Hd;
     759           9 :                                     if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, nPPDrawEnd, &aEscherF002Hd ) )
     760             :                                     {
     761           9 :                                         sal_uInt32 nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
     762           9 :                                         DffRecordHeader aEscherObjListHd;
     763           9 :                                         if ( SeekToRec( rStCtrl, DFF_msofbtSpgrContainer, nEscherF002End, &aEscherObjListHd ) )
     764             :                                         {
     765           9 :                                             sal_uInt32 nObjCount = 0;
     766          77 :                                             while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aEscherObjListHd.GetRecEndFilePos() ) )
     767             :                                             {
     768          59 :                                                 DffRecordHeader aHd2;
     769          59 :                                                 rStCtrl >> aHd2;
     770          59 :                                                 if ( ( aHd2.nRecType == DFF_msofbtSpContainer ) || ( aHd2.nRecType == DFF_msofbtSpgrContainer ) )
     771             :                                                 {
     772          59 :                                                     if ( nObjCount++ )      // skipping the first object
     773             :                                                     {
     774          50 :                                                         Rectangle aEmpty;
     775          50 :                                                         aHd2.SeekToBegOfRecord( rStCtrl );
     776          50 :                                                         SdrObject* pImpObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
     777          50 :                                                         if ( pImpObj )
     778             :                                                         {
     779          50 :                                                             pImpObj->SetLayer( mnBackgroundObjectsLayerID );
     780          50 :                                                             pMPage->NbcInsertObject( pImpObj );
     781             :                                                         }
     782             :                                                     }
     783             :                                                 }
     784          59 :                                                 aHd2.SeekToEndOfRecord( rStCtrl );
     785             :                                             }
     786             :                                         }
     787             :                                     }
     788             :                                 }
     789             :                             }
     790           9 :                             break;
     791             : 
     792             :                             case PPT_PST_ProgTags :
     793             :                             {
     794           2 :                                 DffRecordHeader aProgTagHd;
     795           2 :                                 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
     796             :                                 {
     797           6 :                                     while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
     798             :                                     {
     799           2 :                                         DffRecordHeader aProgTagContentHd;
     800           2 :                                         rStCtrl >> aProgTagContentHd;
     801           2 :                                         switch( aProgTagContentHd.nRecType )
     802             :                                         {
     803             :                                             case DFF_msofbtAnimGroup :
     804             :                                             {
     805           0 :                                                 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pMPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
     806           0 :                                                 ppt::AnimationImporter aImporter( this, rStCtrl );
     807           0 :                                                 bNewAnimationsUsed = aImporter.import( xPage, aProgTagContentHd ) > 0;
     808             :                                             }
     809           0 :                                             break;
     810             :                                         }
     811           2 :                                         aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
     812             :                                     }
     813             :                                 }
     814             :                             }
     815           2 :                             break;
     816             :                         }
     817         106 :                         aHd.SeekToEndOfRecord( rStCtrl );
     818             :                     }
     819             :                 }
     820           9 :                 rStCtrl.Seek( nFPosMerk );
     821           9 :                 ImportPageEffect( (SdPage*)pMPage, bNewAnimationsUsed );
     822             : 
     823             :                 ///////////////////////
     824             :                 // background object //
     825             :                 ///////////////////////
     826           9 :                 pObj = pMPage->GetObj( 0 );
     827           9 :                 if ( pObj && pObj->GetObjIdentifier() == OBJ_RECT )
     828             :                 {
     829           9 :                     if ( pMPage->GetPageKind() == PK_STANDARD )
     830             :                     {
     831             :                         // transform data from imported background object to new form
     832             :                         // and delete the object. It was used as container to transport
     833             :                         // the attributes of the MasterPage background fill
     834           5 :                         SfxStyleSheet* pSheet = pMPage->GetStyleSheetForMasterPageBackground();
     835             : 
     836           5 :                         if(pSheet)
     837             :                         {
     838             :                             // if we have a StyleSheet (for Masterpages), set attributes there and use it
     839           5 :                             pSheet->GetItemSet().ClearItem();
     840           5 :                             pSheet->GetItemSet().Put(pObj->GetMergedItemSet());
     841           5 :                             pMPage->getSdrPageProperties().ClearItem();
     842           5 :                             pMPage->getSdrPageProperties().SetStyleSheet(pSheet);
     843             :                         }
     844             :                         else
     845             :                         {
     846             :                             // without StyleSheet, set attributes directly. This
     847             :                             // should not be done at all and is an error (will be asserted by SdrPage)
     848           0 :                             pMPage->getSdrPageProperties().ClearItem();
     849           0 :                             pMPage->getSdrPageProperties().PutItemSet(pObj->GetMergedItemSet());
     850             :                         }
     851             : 
     852           5 :                         pMPage->RemoveObject(pObj->GetOrdNum());
     853           5 :                         SdrObject::Free(pObj);
     854             :                     }
     855           9 :                 }
     856             :             }
     857             :         }
     858          10 :         if( pStbMgr )
     859          10 :             pStbMgr->SetState( nImportedPages++ );
     860             :     }
     861             :     ////////////////////////////////////
     862             :     // importing slide pages          //
     863             :     ////////////////////////////////////
     864             :     {
     865           5 :         sal_uInt32          nFPosMerk = rStCtrl.Tell();
     866           5 :         PptPageKind     ePageKind = eAktPageKind;
     867           5 :         sal_uInt16          nPageNum = nAktPageNum;
     868             : 
     869           5 :         SdPage* pHandoutPage = (SdPage*)MakeBlancPage( sal_False );
     870           5 :         pHandoutPage->SetPageKind( PK_HANDOUT );
     871           5 :         pSdrModel->InsertPage( pHandoutPage );
     872             : 
     873           5 :         sal_uInt16 nPageAnz = GetPageCount( PPT_SLIDEPAGE );
     874           5 :         if ( nPageAnz )
     875             :         {
     876          37 :             for ( sal_uInt16 nPage = 0; nPage < nPageAnz; nPage++ )
     877             :             {
     878          32 :                 sal_Bool bNewAnimationsUsed = sal_False;
     879             : 
     880          32 :                 mePresChange = PRESCHANGE_SEMIAUTO;
     881          32 :                 SetPageNum( nPage, PPT_SLIDEPAGE );
     882          32 :                 SdPage* pPage = (SdPage*)MakeBlancPage( sal_False );
     883          32 :                 PptSlidePersistEntry* pMasterPersist = NULL;
     884          32 :                 if ( HasMasterPage( nPage, PPT_SLIDEPAGE ) )     // try to get the LayoutName from the masterpage
     885             :                 {
     886          32 :                     sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
     887          32 :                     pPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nMasterNum));
     888          32 :                     PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
     889          32 :                     if ( pPageList && nMasterNum < pPageList->size() )
     890          32 :                         pMasterPersist = (*pPageList)[ nMasterNum ];
     891          32 :                     pPage->SetLayoutName(((SdPage&)pPage->TRG_GetMasterPage()).GetLayoutName());
     892             :                 }
     893          32 :                 pPage->SetPageKind( PK_STANDARD );
     894          32 :                 pSdrModel->InsertPage( pPage );         // SJ: #i29625# because of form controls, the
     895          32 :                 ImportPage( pPage, pMasterPersist );    //  page must be inserted before importing
     896          32 :                 SetHeaderFooterPageSettings( pPage, pMasterPersist );
     897             :                 // CWS preseng01: pPage->SetPageKind( PK_STANDARD );
     898             : 
     899          32 :                 DffRecordHeader aPageHd;
     900          32 :                 if ( SeekToAktPage( &aPageHd ) )
     901             :                 {
     902          32 :                     aPageHd.SeekToContent( rStCtrl );
     903         200 :                     while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
     904             :                     {
     905         136 :                         DffRecordHeader aHd;
     906         136 :                         rStCtrl >> aHd;
     907         136 :                         switch ( aHd.nRecType )
     908             :                         {
     909             :                             case PPT_PST_ProgTags :
     910             :                             {
     911          32 :                                 DffRecordHeader aProgTagHd;
     912          32 :                                 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
     913             :                                 {
     914         183 :                                     while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
     915             :                                     {
     916         119 :                                         DffRecordHeader aProgTagContentHd;
     917         119 :                                         rStCtrl >> aProgTagContentHd;
     918         119 :                                         switch( aProgTagContentHd.nRecType )
     919             :                                         {
     920             :                                             case DFF_msofbtAnimGroup :
     921             :                                             {
     922          32 :                                                 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
     923          32 :                                                 ppt::AnimationImporter aImporter( this, rStCtrl );
     924          32 :                                                 bNewAnimationsUsed = aImporter.import( xPage, aProgTagContentHd ) > 0;
     925             :                                             }
     926          32 :                                             break;
     927             : 
     928             :                                             case PPT_PST_NewlyAddedAtomByXP11008 :  // ???
     929          32 :                                             break;
     930             : 
     931             :                                             case PPT_PST_NewlyAddedAtomByXP12011 :  // ??? don't know, this atom is always 8 bytes big
     932          23 :                                             break;                                  // and is appearing in nearly every l10 progtag
     933             :                                         }
     934         119 :                                         aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
     935             :                                     }
     936             :                                 }
     937             :                             }
     938          32 :                             break;
     939             : 
     940             :                             case PPT_PST_HeadersFooters :
     941             :                             case PPT_PST_PPDrawing :
     942             :                             default:
     943         104 :                             break;
     944             :                         }
     945             : 
     946         136 :                         aHd.SeekToEndOfRecord( rStCtrl );
     947             :                     }
     948          32 :                     ImportPageEffect( (SdPage*)pPage, bNewAnimationsUsed );
     949             :                 }
     950             : 
     951             :                 // creating the corresponding note page
     952          32 :                 eAktPageKind = PPT_NOTEPAGE;
     953          32 :                 SdPage* pNotesPage = (SdPage*)MakeBlancPage( sal_False );
     954          32 :                 sal_uInt16 nNotesMasterNum = GetMasterPageIndex( nPage, PPT_SLIDEPAGE ) + 1;
     955          32 :                 sal_uInt32 nNotesPageId = GetNotesPageId( nPage );
     956          32 :                 if ( nNotesPageId )
     957             :                 {
     958          20 :                     nImportedPages++;
     959          20 :                     sal_uInt16 nNotesPageIndex = pNotePages->FindPage( nNotesPageId );
     960          20 :                     if ( nNotesPageIndex == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
     961           0 :                         nNotesPageIndex = 0;
     962          20 :                     SetPageNum( nNotesPageIndex, PPT_NOTEPAGE );
     963          20 :                     PptSlidePersistEntry* pMasterPersist2 = NULL;
     964          20 :                     if ( HasMasterPage( nNotesPageIndex, PPT_NOTEPAGE ) ) // try to get the LayoutName from the masterpage
     965             :                     {
     966          20 :                         pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
     967          20 :                         PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
     968          20 :                         if ( pPageList && nNotesMasterNum < pPageList->size() )
     969          20 :                             pMasterPersist2 = (*pPageList)[ nNotesMasterNum ];
     970          20 :                         pNotesPage->SetLayoutName( ((SdPage&)pNotesPage->TRG_GetMasterPage()).GetLayoutName() );
     971             :                     }
     972          20 :                     pNotesPage->SetPageKind( PK_NOTES );
     973          20 :                     pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
     974          20 :                     pSdrModel->InsertPage( pNotesPage );        // SJ: #i29625# because of form controls, the
     975          20 :                     ImportPage( pNotesPage, pMasterPersist2 );  // page must be inserted before importing
     976          20 :                     SetHeaderFooterPageSettings( pNotesPage, pMasterPersist2 );
     977          20 :                     pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, sal_False );
     978             :                 }
     979             :                 else
     980             :                 {
     981          12 :                     pNotesPage->SetPageKind( PK_NOTES );
     982          12 :                     pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
     983          12 :                     pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, sal_True );
     984          12 :                     pSdrModel->InsertPage( pNotesPage );
     985          12 :                     SdrObject* pPageObj = pNotesPage->GetPresObj( PRESOBJ_PAGE, 1 );
     986          12 :                     if ( pPageObj )
     987          12 :                         ((SdrPageObj*)pPageObj)->SetReferencedPage(pSdrModel->GetPage(( nPage << 1 ) + 1));
     988             :                 }
     989             : 
     990          32 :                 if( pStbMgr )
     991          32 :                     pStbMgr->SetState( nImportedPages++ );
     992             :             }
     993             :             //////////////
     994             :         }
     995             :         else
     996             :         {
     997             :             // Das kann bei Dokumentvorlagen vorkommen
     998           0 :             eAktPageKind = PPT_SLIDEPAGE;
     999           0 :             SdrPage* pPage = MakeBlancPage( sal_False );
    1000           0 :             pSdrModel->InsertPage( pPage );
    1001             : 
    1002             :             // #i37397#, trying to set the title master for the first page
    1003           0 :             sal_uInt16 nMaster, nMasterCount = pSdrModel->GetMasterPageCount();
    1004           0 :             SdPage* pFoundMaster = NULL;
    1005           0 :             for ( nMaster = 1; nMaster < nMasterCount; nMaster++ )
    1006             :             {
    1007           0 :                 SdPage* pMaster = static_cast<SdPage*>( pSdrModel->GetMasterPage( nMaster ) );
    1008           0 :                 if ( pMaster->GetPageKind() == PK_STANDARD )
    1009             :                 {
    1010           0 :                     SetPageNum( nMaster, PPT_MASTERPAGE );
    1011           0 :                     if ( !pFoundMaster )
    1012           0 :                         pFoundMaster = pMaster;
    1013           0 :                     else if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
    1014           0 :                         pFoundMaster = pMaster;
    1015           0 :                     if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
    1016           0 :                         break;
    1017             :                 }
    1018             :             }
    1019           0 :             if ( pFoundMaster )
    1020             :             {
    1021           0 :                 ((SdPage*)pPage)->TRG_SetMasterPage( *((SdPage*)pFoundMaster) );
    1022           0 :                 ((SdPage*)pPage)->SetLayoutName( ((SdPage*)pFoundMaster)->GetLayoutName() );
    1023             :             }
    1024           0 :             ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_TITLE, sal_True, sal_True );
    1025             : 
    1026           0 :             eAktPageKind = PPT_NOTEPAGE;
    1027           0 :             SdrPage* pNPage = MakeBlancPage( sal_False );
    1028           0 :             pSdrModel->InsertPage( pNPage );
    1029             :         }
    1030           5 :         SetPageNum( nPageNum, ePageKind );
    1031           5 :         rStCtrl.Seek( nFPosMerk );
    1032             :     }
    1033             :     ///////////////////////////////////////////////////////////////////
    1034             :     // Handzettel und Notiz-Seiten erzeugen                          //
    1035             :     ///////////////////////////////////////////////////////////////////
    1036           5 :     bOk = mpDoc->CreateMissingNotesAndHandoutPages();
    1037           5 :     if ( bOk )
    1038             :     {
    1039          37 :         for ( i = 0; i < mpDoc->GetSdPageCount( PK_STANDARD ); i++ )
    1040             :         {
    1041             :             ////////////////////
    1042             :             // set AutoLayout //
    1043             :             ////////////////////
    1044          32 :             SetPageNum( i, PPT_SLIDEPAGE );
    1045          32 :             SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
    1046          32 :             AutoLayout eAutoLayout = AUTOLAYOUT_NONE;
    1047          32 :             const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
    1048          32 :             if ( pSlideLayout )
    1049             :             {
    1050          32 :                 switch ( pSlideLayout->eLayout )            // Praesentationslayouts fuer Standard-Seiten
    1051             :                 {
    1052             :                     case PPT_LAYOUT_TITLEANDBODYSLIDE :
    1053             :                     {
    1054          25 :                         eAutoLayout = AUTOLAYOUT_ENUM;
    1055          25 :                         sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
    1056          25 :                         switch ( nID1 )
    1057             :                         {
    1058             :                             case PPT_PLACEHOLDER_BODY :
    1059          20 :                                 eAutoLayout = AUTOLAYOUT_ENUM;
    1060          20 :                             break;
    1061             :                             case PPT_PLACEHOLDER_TABLE :
    1062           1 :                                 eAutoLayout = AUTOLAYOUT_TAB;
    1063           1 :                             break;
    1064             :                             case PPT_PLACEHOLDER_ORGANISZATIONCHART :
    1065           0 :                                 eAutoLayout = AUTOLAYOUT_ORG;
    1066           0 :                             break;
    1067             :                             case PPT_PLACEHOLDER_GRAPH :
    1068           3 :                                 eAutoLayout = AUTOLAYOUT_CHART;
    1069           3 :                             break;
    1070             :                             case PPT_PLACEHOLDER_OBJECT :
    1071           1 :                                 eAutoLayout = AUTOLAYOUT_OBJ;
    1072           1 :                             break;
    1073             :                             case PPT_PLACEHOLDER_VERTICALTEXTBODY :
    1074           0 :                                 eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE;
    1075           0 :                             break;
    1076             :                         }
    1077             :                     }
    1078          25 :                     break;
    1079             : 
    1080             :                     case PPT_LAYOUT_2COLUMNSANDTITLE :
    1081             :                     {
    1082           2 :                         eAutoLayout = AUTOLAYOUT_2TEXT;
    1083           2 :                         sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
    1084           2 :                         sal_uInt16 nID2 = pSlideLayout->aPlaceholderId[ 2 ];
    1085           2 :                         if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_GRAPH )
    1086           0 :                             eAutoLayout = AUTOLAYOUT_TEXTCHART;
    1087           2 :                         else if ( nID1 == PPT_PLACEHOLDER_GRAPH && nID2 == PPT_PLACEHOLDER_BODY )
    1088           0 :                             eAutoLayout = AUTOLAYOUT_CHARTTEXT;
    1089           2 :                         else if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_CLIPART )
    1090           0 :                             eAutoLayout = AUTOLAYOUT_TEXTCLIP;
    1091           2 :                         else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_BODY )
    1092           0 :                             eAutoLayout = AUTOLAYOUT_CLIPTEXT;
    1093           2 :                         else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_VERTICALTEXTBODY )
    1094           0 :                             eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART;
    1095           2 :                         else if ( ( nID1 == PPT_PLACEHOLDER_BODY )
    1096             :                             && ( ( nID2 == PPT_PLACEHOLDER_OBJECT ) || ( nID2 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
    1097           1 :                             eAutoLayout = AUTOLAYOUT_TEXTOBJ;
    1098           1 :                         else if ( ( nID2 == PPT_PLACEHOLDER_BODY )
    1099             :                             && ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) || ( nID1 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
    1100           0 :                             eAutoLayout = AUTOLAYOUT_OBJTEXT;
    1101           1 :                         else if ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) && ( nID2 == PPT_PLACEHOLDER_OBJECT  ) )
    1102           1 :                             eAutoLayout = AUTOLAYOUT_OBJ;
    1103             :                     }
    1104           2 :                     break;
    1105             : 
    1106             :                     case PPT_LAYOUT_2ROWSANDTITLE :
    1107             :                     {
    1108           0 :                         eAutoLayout = AUTOLAYOUT_2TEXT;
    1109           0 :                         sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
    1110           0 :                         sal_uInt16 nID2 = pSlideLayout->aPlaceholderId[ 2 ];
    1111           0 :                         if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_OBJECT )
    1112           0 :                             eAutoLayout = AUTOLAYOUT_TEXTOVEROBJ;
    1113           0 :                         else if ( nID1 == PPT_PLACEHOLDER_OBJECT && nID2 == PPT_PLACEHOLDER_BODY )
    1114           0 :                             eAutoLayout = AUTOLAYOUT_OBJOVERTEXT;
    1115             :                     }
    1116           0 :                     break;
    1117             : 
    1118             :                     case PPT_LAYOUT_TITLESLIDE :
    1119           2 :                         eAutoLayout = AUTOLAYOUT_TITLE;
    1120           2 :                     break;
    1121             :                     case PPT_LAYOUT_ONLYTITLE :
    1122           0 :                         eAutoLayout = AUTOLAYOUT_ONLY_TITLE;
    1123           0 :                     break;
    1124             :                     case PPT_LAYOUT_RIGHTCOLUMN2ROWS :
    1125           3 :                         eAutoLayout = AUTOLAYOUT_TEXT2OBJ;
    1126           3 :                     break;
    1127             :                     case PPT_LAYOUT_LEFTCOLUMN2ROWS :
    1128           0 :                         eAutoLayout = AUTOLAYOUT_2OBJTEXT;
    1129           0 :                     break;
    1130             :                     case PPT_LAYOUT_TOPROW2COLUMN :
    1131           0 :                         eAutoLayout = AUTOLAYOUT_2OBJOVERTEXT;
    1132           0 :                     break;
    1133             :                     case PPT_LAYOUT_4OBJECTS :
    1134           0 :                         eAutoLayout = AUTOLAYOUT_4OBJ;
    1135           0 :                     break;
    1136             :                     case PPT_LAYOUT_BIGOBJECT :
    1137           0 :                         eAutoLayout = AUTOLAYOUT_OBJ;
    1138           0 :                     break;
    1139             :                     case PPT_LAYOUT_TITLERIGHTBODYLEFT :
    1140           0 :                         eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE; // AUTOLAYOUT_ENUM;
    1141           0 :                     break;
    1142             :                     case PPT_LAYOUT_TITLERIGHT2BODIESLEFT :
    1143           0 :                         eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART; // AUTOLAYOUT_TEXT2OBJ;
    1144           0 :                     break;
    1145             : 
    1146             :                     case PPT_LAYOUT_BOTTOMROW2COLUMNS :
    1147             :                     case PPT_LAYOUT_BLANCSLIDE :
    1148             :                     case PPT_LAYOUT_MASTERSLIDE :           // Layout der Standard- und Titel-MasterPage
    1149             :                     case PPT_LAYOUT_TITLEMASTERSLIDE :
    1150             :                     case PPT_LAYOUT_MASTERNOTES :           // Layout der Notizen-MasterPage
    1151             :                     case PPT_LAYOUT_NOTESTITLEBODY :        // Praesentationslayout fuer Notiz-Seiten
    1152             :                     case PPT_LAYOUT_HANDOUTLAYOUT :         // Praesentationslayout fuer Handzettelseiten
    1153           0 :                         eAutoLayout = AUTOLAYOUT_NONE;
    1154           0 :                     break;
    1155             :                 }
    1156          32 :                 if ( eAutoLayout != AUTOLAYOUT_NONE )
    1157          32 :                     pPage->SetAutoLayout( eAutoLayout, sal_False );
    1158             :             }
    1159             :         }
    1160             :         //////////////////////////////////////////////////////////////
    1161             :         // Handzettel-MasterPage: Autolayout setzen                 //
    1162             :         //////////////////////////////////////////////////////////////
    1163           5 :         SdPage* pHandoutMPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
    1164           5 :         pHandoutMPage->SetAutoLayout( AUTOLAYOUT_HANDOUT6, sal_True, sal_True );
    1165             :     }
    1166             : 
    1167           5 :     sal_uInt32 nSlideCount = GetPageCount();
    1168           5 :     for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.size() ); i++ )
    1169             :     {
    1170           0 :         SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
    1171           0 :         String &aName = maSlideNameList[ i ];
    1172           0 :         if ( pPage )
    1173             :         {
    1174           0 :             if ( aName.Len() )
    1175           0 :                 pPage->SetName( aName );
    1176             :             else
    1177           0 :                 aName = pPage->GetName();
    1178             :         }
    1179             :     }
    1180           5 :     if ( mbDocumentFound )
    1181             :     {
    1182           5 :         mpDoc->SetSummationOfParagraphs( sal_True );
    1183           5 :         if ( pDocShell )
    1184             :         {
    1185           5 :             ::sd::FrameView* pFrameView = mpDoc->GetFrameView( 0 );
    1186           5 :             if ( !pFrameView )
    1187             :             {
    1188           5 :                 std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
    1189           5 :                 pFrameView = new ::sd::FrameView( mpDoc );
    1190           5 :                 rViews.push_back( pFrameView );
    1191             :             }
    1192           5 :             if ( pFrameView )
    1193             :             {
    1194           5 :                 sal_uInt16  nSelectedPage = 0;
    1195           5 :                 PageKind    ePageKind = PK_STANDARD;
    1196           5 :                 EditMode    eEditMode = EM_PAGE;
    1197             : 
    1198           5 :                 switch ( aUserEditAtom.eLastViewType )
    1199             :                 {
    1200             :                     case 7 :    // outliner view
    1201             :                     {
    1202           0 :                         SfxItemSet* pSet = mrMed.GetItemSet();
    1203           0 :                         if ( pSet )
    1204           0 :                             pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
    1205             :                     }
    1206           0 :                     break;
    1207             :                     case 8 :    // slide sorter
    1208             :                     {
    1209           0 :                         SfxItemSet* pSet = mrMed.GetItemSet();
    1210           0 :                         if ( pSet )
    1211           0 :                             pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
    1212             :                     }
    1213           0 :                     break;
    1214             :                     case 10 :   // titlemaster
    1215           0 :                         nSelectedPage = 1;
    1216             :                     case 2 :    // master
    1217             :                     {
    1218           0 :                         ePageKind = PK_STANDARD;
    1219           0 :                         eEditMode = EM_MASTERPAGE;
    1220             :                     }
    1221           0 :                     break;
    1222             :                     case 5 :    // notes master
    1223           0 :                         eEditMode = EM_MASTERPAGE;
    1224             :                     case 3 :    // notes
    1225           0 :                         ePageKind = PK_NOTES;
    1226           0 :                     break;
    1227             :                     case 4 :    // handout
    1228           0 :                         ePageKind = PK_HANDOUT;
    1229           0 :                     break;
    1230             :                     default :
    1231             :                     case 1 :    // normal
    1232           5 :                     break;
    1233             :                 }
    1234           5 :                 pFrameView->SetPageKind( ePageKind );
    1235           5 :                 pFrameView->SetSelectedPage( nSelectedPage );
    1236           5 :                 pFrameView->SetViewShEditMode( eEditMode, ePageKind );
    1237             :             }
    1238             :         }
    1239           5 :         DffRecordHeader aCustomShowHeader;
    1240             :         // custom show einlesen und setzen
    1241           5 :         rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
    1242           5 :         if ( SeekToRec( rStCtrl, PPT_PST_NamedShows, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
    1243             :         {
    1244           0 :             DffRecordHeader aCuHeader;
    1245           0 :             while( SeekToRec( rStCtrl, PPT_PST_NamedShow, aCustomShowHeader.GetRecEndFilePos(), &aCuHeader ) )
    1246             :             {
    1247           0 :                 DffRecordHeader aContent;
    1248           0 :                 if ( SeekToRec( rStCtrl, PPT_PST_CString, aCuHeader.GetRecEndFilePos(), &aContent ) )
    1249             :                 {
    1250           0 :                     rtl::OUString aCuShow;
    1251           0 :                     aContent.SeekToBegOfRecord( rStCtrl );
    1252           0 :                     if ( ReadString( aCuShow ) )
    1253             :                     {
    1254           0 :                         if ( SeekToRec( rStCtrl, PPT_PST_NamedShowSlides, aCuHeader.GetRecEndFilePos(), &aContent ) )
    1255             :                         {
    1256           0 :                             PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
    1257           0 :                             sal_uInt32 nSCount = aContent.nRecLen >> 2;
    1258           0 :                             if ( pPageList && nSCount )
    1259             :                             {
    1260           0 :                                 SdCustomShowList* pList = mpDoc->GetCustomShowList( sal_True );
    1261           0 :                                 if ( pList )
    1262             :                                 {
    1263           0 :                                     SdCustomShow* pSdCustomShow = new SdCustomShow( mpDoc );
    1264           0 :                                     if ( pSdCustomShow )
    1265             :                                     {
    1266           0 :                                         pSdCustomShow->SetName( aCuShow );
    1267           0 :                                         sal_uInt32 nFound = 0;
    1268           0 :                                         for ( sal_uInt32 nS = 0; nS < nSCount; nS++ )
    1269             :                                         {
    1270             :                                             sal_uInt32 nPageNumber;
    1271           0 :                                             rStCtrl >> nPageNumber;
    1272           0 :                                             sal_uInt16 nPage = pPageList->FindPage( nPageNumber );
    1273           0 :                                             if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
    1274             :                                             {
    1275           0 :                                                 SdPage* pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
    1276           0 :                                                 if ( pPage )
    1277             :                                                 {
    1278           0 :                                                     pSdCustomShow->PagesVector().push_back( pPage );
    1279           0 :                                                     nFound++;
    1280             :                                                 }
    1281             :                                             }
    1282             :                                         }
    1283           0 :                                         if ( nFound )
    1284           0 :                                             pList->push_back( pSdCustomShow );
    1285             :                                         else
    1286           0 :                                             delete pSdCustomShow;
    1287             :                                     }
    1288             :                                 }
    1289             :                             }
    1290             :                         }
    1291           0 :                     }
    1292             :                 }
    1293             :             }
    1294             :         }
    1295             :         // this is defaulted, maybe there is no SSDocInfoAtom
    1296           5 :         String      aCustomShow;
    1297           5 :         sal_uInt32  nFlags = 1;                 // Bit 0:   Auto advance
    1298           5 :         sal_uInt16  nStartSlide = 0;
    1299             : 
    1300             :         // read the pres. configuration
    1301           5 :         rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
    1302           5 :         if ( SeekToRec( rStCtrl, PPT_PST_SSDocInfoAtom, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
    1303             :         {
    1304           3 :             sal_uInt32  nPenColor = 0x1000000;
    1305           3 :             sal_Int32   nRestartTime = 0x7fffffff;
    1306           3 :             sal_Int16   nEndSlide = 0;
    1307           3 :             rStCtrl >> nPenColor
    1308           3 :                     >> nRestartTime
    1309           3 :                     >> nStartSlide
    1310           3 :                     >> nEndSlide;
    1311             : 
    1312             :             sal_Unicode nChar;
    1313           3 :             for ( sal_uInt32 i2 = 0; i2 < 32; i2++ )
    1314             :             {
    1315           3 :                 rStCtrl >> nChar;
    1316           3 :                 if ( nChar )
    1317           0 :                     aCustomShow.Append( nChar );
    1318             :                 else
    1319             :                 {
    1320           3 :                     rStCtrl.SeekRel( ( 31 - i2 ) << 1 );
    1321           3 :                     break;
    1322             :                 }
    1323             :             }
    1324           3 :             rStCtrl >> nFlags;
    1325             :         }
    1326             :         // set the current custom show
    1327           5 :         if ( aCustomShow.Len() )
    1328             :         {
    1329           0 :             SdCustomShowList* pList = mpDoc->GetCustomShowList( sal_False );
    1330           0 :             if ( pList )
    1331             :             {
    1332           0 :                 SdCustomShow* pPtr = NULL;
    1333           0 :                 for( pPtr = pList->First(); pPtr; pPtr = pList->Next() )
    1334             :                 {
    1335           0 :                     if ( pPtr->GetName() == aCustomShow )
    1336           0 :                         break;
    1337             :                 }
    1338           0 :                 if ( !pPtr )
    1339           0 :                     pList->First();
    1340             :             }
    1341             :         }
    1342           5 :         sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
    1343             : 
    1344           5 :         rPresSettings.mbManual = ( nFlags & 1 ) == 0;
    1345           5 :         rPresSettings.mbAnimationAllowed = ( nFlags & 2 ) == 0;
    1346           5 :         rPresSettings.mbAll = ( nFlags & 4 ) == 0;
    1347           5 :         rPresSettings.mbCustomShow = ( nFlags & 8 ) != 0;
    1348           5 :         rPresSettings.mbEndless = ( nFlags & 0x80 ) != 0;
    1349           5 :         rPresSettings.mbFullScreen = ( nFlags & 0x10 ) == 0;
    1350             : 
    1351           5 :         if ( nStartSlide && ( nStartSlide <= GetPageCount() ) )
    1352             :         {
    1353           0 :             SdPage* pPage = mpDoc->GetSdPage( nStartSlide - 1, PK_STANDARD );
    1354           0 :             if ( pPage )
    1355           0 :                 rPresSettings.maPresPage = pPage->GetName();
    1356           5 :         }
    1357             :     }
    1358             : 
    1359           5 :     delete pStbMgr;
    1360             : 
    1361             :     // read DocumentProperties
    1362             :     uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
    1363           5 :         mpDoc->GetObjectShell()->GetModel(), uno::UNO_QUERY_THROW);
    1364             :     uno::Reference<document::XDocumentProperties> xDocProps
    1365           5 :         = xDPS->getDocumentProperties();
    1366           5 :     sfx2::LoadOlePropertySet(xDocProps, &mrStorage);
    1367           5 :     xDocProps->setTemplateName(::rtl::OUString());
    1368             : 
    1369           5 :     pSdrModel->setLock(false);
    1370           5 :     pSdrModel->EnableUndo(true);
    1371           5 :     return bOk;
    1372             : }
    1373             : 
    1374          52 : void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist )
    1375             : {
    1376             :     sal_uInt32 i;
    1377          52 :     PptSlidePersistList* pList = GetPageList( eAktPageKind );
    1378          52 :     if ( ( !pList ) || ( pList->size() <= nAktPageNum ) )
    1379          52 :         return;
    1380          52 :     PptSlidePersistEntry& rSlidePersist = *(*pList)[ nAktPageNum ];
    1381          52 :     HeaderFooterEntry* pHFE = rSlidePersist.pHeaderFooterEntry;
    1382          52 :     if ( pHFE )
    1383             :     {
    1384         260 :         for ( i = 0; i < 4; i++ )
    1385             :         {
    1386         208 :             bool bVisible = pHFE->IsToDisplay( i );
    1387         208 :             if ( ( eAktPageKind == PPT_SLIDEPAGE )
    1388             :                 && ( rSlidePersist.aSlideAtom.aLayout.eLayout == PPT_LAYOUT_TITLESLIDE )
    1389             :                     && ( aDocAtom.bTitlePlaceholdersOmitted == sal_True ) )
    1390             :             {
    1391           0 :                 bVisible = sal_False;
    1392             :             }
    1393         208 :             if ( bVisible && pMasterPersist )
    1394             :             {
    1395         170 :                 sal_uInt32 nPosition = pHFE->NeedToImportInstance( i, rSlidePersist );
    1396         170 :                 if ( nPosition )
    1397             :                 {
    1398           4 :                     Rectangle aEmpty;
    1399           4 :                     bVisible = sal_False;
    1400           4 :                     rStCtrl.Seek( nPosition );
    1401           4 :                     ProcessData aProcessData( rSlidePersist, (SdPage*)pPage );
    1402           4 :                     SdrObject* pObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
    1403           4 :                     if ( pObj )
    1404           4 :                         pPage->NbcInsertObject( pObj, 0 );
    1405             :                 }
    1406             :             }
    1407         208 :             String aPlaceHolderString;
    1408         208 :             if ( pHFE->pPlaceholder )
    1409         208 :                 aPlaceHolderString = pHFE->pPlaceholder[ i ];
    1410             : 
    1411         208 :             sd::HeaderFooterSettings rHeaderFooterSettings( pPage->getHeaderFooterSettings() );
    1412         208 :             switch( i )
    1413             :             {
    1414             :                 case 0 :
    1415             :                 {
    1416          52 :                     rHeaderFooterSettings.mbDateTimeVisible = bVisible;
    1417          52 :                     rHeaderFooterSettings.mbDateTimeIsFixed = ( pHFE->nAtom & 0x20000 ) == 0;
    1418          52 :                     rHeaderFooterSettings.maDateTimeText = aPlaceHolderString;
    1419             :                     SvxDateFormat eDateFormat;
    1420             :                     SvxTimeFormat eTimeFormat;
    1421          52 :                     PPTFieldEntry::GetDateTime( pHFE->nAtom & 0xff, eDateFormat, eTimeFormat );
    1422          52 :                     rHeaderFooterSettings.meDateTimeFormat = eDateFormat | ( eTimeFormat << 4 );
    1423             :                 }
    1424          52 :                 break;
    1425             :                 case 1 :
    1426             :                 {
    1427          52 :                     rHeaderFooterSettings.mbHeaderVisible = bVisible;
    1428          52 :                     rHeaderFooterSettings.maHeaderText = aPlaceHolderString;
    1429             :                 }
    1430          52 :                 break;
    1431             :                 case 2 :
    1432             :                 {
    1433          52 :                     rHeaderFooterSettings.mbFooterVisible = bVisible;
    1434          52 :                     rHeaderFooterSettings.maFooterText = aPlaceHolderString;
    1435             :                 }
    1436          52 :                 break;
    1437             :                 case 3 :
    1438             :                 {
    1439          52 :                     rHeaderFooterSettings.mbSlideNumberVisible = bVisible;
    1440             :                 }
    1441          52 :                 break;
    1442             :             }
    1443         208 :             pPage->setHeaderFooterSettings( rHeaderFooterSettings );
    1444         208 :         }
    1445             :     }
    1446             : }
    1447             : 
    1448             : //////////////////////////////////////////////////////////////////////////
    1449             : //
    1450             : // Import von Seiten
    1451             : //
    1452             : //////////////////////////////////////////////////////////////////////////
    1453             : 
    1454             : struct Ppt97AnimationStlSortHelper
    1455             : {
    1456             :     bool operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 );
    1457             : };
    1458             : 
    1459          57 : bool Ppt97AnimationStlSortHelper::operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 )
    1460             : {
    1461          57 :     if( !p1.second.get() || !p2.second.get() )
    1462           0 :         return true;
    1463          57 :     if( *p1.second < *p2.second )
    1464          21 :         return true;
    1465          36 :     if( *p1.second > *p2.second )
    1466          36 :         return false;
    1467           0 :     if( p1.first->GetOrdNum() < p2.first->GetOrdNum() )
    1468           0 :         return true;
    1469           0 :     return false;
    1470             : }
    1471             : 
    1472          41 : void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimationsUsed )
    1473             : {
    1474          41 :     sal_uLong nFilePosMerk = rStCtrl.Tell();
    1475             : 
    1476             :     // PageKind an der Seite setzen (bisher nur PK_STANDARD oder PK_NOTES)
    1477          41 :     if ( pPage->GetPageKind() == PK_STANDARD )
    1478             :     {
    1479          37 :         PptSlidePersistList* pPersistList = GetPageList( eAktPageKind );
    1480          37 :         PptSlidePersistEntry* pActualSlidePersist = ( pPersistList && ( nAktPageNum < pPersistList->size() ) )
    1481          74 :                                                         ? (*pPersistList)[ nAktPageNum ] : NULL;
    1482             : 
    1483          37 :         if ( pActualSlidePersist && ( eAktPageKind == PPT_SLIDEPAGE ) )
    1484             :         {
    1485          32 :             if ( ! ( pActualSlidePersist->aSlideAtom.nFlags & 1 ) ) // do not follow master objects ?
    1486             :             {
    1487           0 :                 if(pPage->TRG_HasMasterPage())
    1488             :                 {
    1489           0 :                     SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
    1490           0 :                     aVisibleLayers.Set(mnBackgroundObjectsLayerID, sal_False);
    1491           0 :                     pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
    1492             :                 }
    1493             :             }
    1494             :         }
    1495          37 :         DffRecordHeader aPageRecHd;
    1496          37 :         if ( pPage && SeekToAktPage( &aPageRecHd ) )
    1497             :         {
    1498          37 :             sal_uLong nPageRecEnd = aPageRecHd.GetRecEndFilePos();
    1499             : 
    1500          37 :             sal_Bool bTryTwice = ( eAktPageKind == PPT_SLIDEPAGE );
    1501          37 :             sal_Bool bSSSlideInfoAtom = sal_False;
    1502           0 :             while ( sal_True )
    1503             :             {
    1504         303 :                 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nPageRecEnd ) )
    1505             :                 {
    1506         229 :                     DffRecordHeader aHd;
    1507         229 :                     rStCtrl >> aHd;
    1508         229 :                     switch ( aHd.nRecType )
    1509             :                     {
    1510             :                         case PPT_PST_SSSlideInfoAtom:
    1511             :                         {
    1512           5 :                             bSSSlideInfoAtom = sal_True;
    1513           5 :                             if ( eAktPageKind == PPT_MASTERPAGE )
    1514             :                             {
    1515           0 :                                 if ( pActualSlidePersist )
    1516           0 :                                     pActualSlidePersist->aPersistAtom.nReserved = aHd.GetRecBegFilePos();
    1517             :                             }
    1518             :                             else
    1519             :                             {
    1520             :                                 sal_Int8    nDirection, nTransitionType, nByteDummy, nSpeed;
    1521             :                                 sal_Int16   nBuildFlags;
    1522             :                                 sal_Int32   nSlideTime, nSoundRef;
    1523           5 :                                 rStCtrl >> nSlideTime           // Standzeit (in Ticks)
    1524           5 :                                         >> nSoundRef            // Index in SoundCollection
    1525           5 :                                         >> nDirection           // Richtung des Ueberblendeffekts
    1526           5 :                                         >> nTransitionType      // Ueberblendeffekt
    1527           5 :                                         >> nBuildFlags          // Buildflags (s.u.)
    1528           5 :                                         >> nSpeed               // Geschwindigkeit (langsam, mittel, schnell)
    1529           5 :                                         >> nByteDummy >> nByteDummy >> nByteDummy;
    1530             : 
    1531           5 :                                 switch ( nTransitionType )
    1532             :                                 {
    1533             :                                     case PPT_TRANSITION_TYPE_BLINDS :
    1534             :                                     {
    1535           0 :                                         if ( nDirection == 0 )
    1536           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES );// Vertikal blenden
    1537           0 :                                         else if ( nDirection == 1 )
    1538           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES );// Horizontal blenden
    1539             :                                     }
    1540           0 :                                     break;
    1541             :                                     case PPT_TRANSITION_TYPE_CHECKER :
    1542             :                                     {
    1543           0 :                                         if ( nDirection == 0 )
    1544           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD );// Vertikal versetzt einblenden ??
    1545           0 :                                         else if ( nDirection == 1 )
    1546           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD );// Horizontal versetzt einblenden ??
    1547             :                                     }
    1548           0 :                                     break;
    1549             :                                     case PPT_TRANSITION_TYPE_COVER :
    1550             :                                     {
    1551           0 :                                         if ( nDirection == 0 )
    1552           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT );     // Von rechts ueberdecken
    1553           0 :                                         else if ( nDirection == 1 )
    1554           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM );    // Von unten ueberdecken
    1555           0 :                                         else if ( nDirection == 2 )
    1556           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT );      // Von links ueberdecken
    1557           0 :                                         else if ( nDirection == 3 )
    1558           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP );       // Von oben ueberdecken
    1559           0 :                                         else if ( nDirection == 4 )
    1560           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT );// Von rechts unten ueberdecken ??
    1561           0 :                                         else if ( nDirection == 5 )
    1562           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT ); // Von links unten ueberdecken ??
    1563           0 :                                         else if ( nDirection == 6 )
    1564           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT );// Von rechts oben ueberdecken
    1565           0 :                                         else if ( nDirection == 7 )
    1566           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT ); // Von links oben ueberdecken ??
    1567             :                                     }
    1568           0 :                                     break;
    1569             :                                     case PPT_TRANSITION_TYPE_NONE :
    1570             :                                     {
    1571           5 :                                         if ( nBuildFlags )
    1572             :                                         {
    1573           5 :                                             if ( nDirection == 0 )
    1574           0 :                                                 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_NONE );                // Direkt
    1575           5 :                                             else if ( nDirection == 1 )
    1576             :                                             {
    1577           0 :                                                 pPage->setTransitionType( animations::TransitionType::BARWIPE );
    1578           0 :                                                 pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
    1579           0 :                                                 pPage->setTransitionFadeColor( 0 );
    1580             :                                             }
    1581             :                                         }
    1582             :                                         else
    1583           0 :                                             pPage->setTransitionType( 0 );
    1584             :                                     }
    1585           5 :                                     break;
    1586             :                                     case PPT_TRANSITION_TYPE_DISSOLVE :
    1587           0 :                                         pPage->SetFadeEffect(::com::sun::star::presentation::FadeEffect_DISSOLVE);                  // Aufloesen
    1588           0 :                                     break;
    1589             :                                     case PPT_TRANSITION_TYPE_RANDOM_BARS :
    1590             :                                     {
    1591           0 :                                         if ( nDirection == 0 )
    1592           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES );    // Horizontale Linien
    1593           0 :                                         else if ( nDirection == 1 )
    1594           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES );      // Vertikale Linien
    1595             :                                     }
    1596           0 :                                     break;
    1597             :                                     case PPT_TRANSITION_TYPE_SPLIT :
    1598             :                                     {
    1599           0 :                                         if ( nDirection == 0 )
    1600           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL );   // Horizontal oeffnen
    1601           0 :                                         else if ( nDirection == 1 )
    1602           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL );  // Horizontal schliessen
    1603           0 :                                         else if ( nDirection == 2 )
    1604           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL ); // Vertikal oeffnen
    1605           0 :                                         else if ( nDirection == 3 )
    1606           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL );// Vertikal schliessen
    1607             :                                     }
    1608           0 :                                     break;
    1609             :                                     case PPT_TRANSITION_TYPE_STRIPS :
    1610             :                                     {
    1611           0 :                                         if ( nDirection == 4 )
    1612           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT );// Diagonal nach links oben
    1613           0 :                                         else if ( nDirection == 5 )
    1614           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT ); // Diagonal nach rechts oben
    1615           0 :                                         else if ( nDirection == 6 )
    1616           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT );// Diagonal nach links unten
    1617           0 :                                         else if ( nDirection == 7 )
    1618           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT ); // Diagonal nach rechts unten
    1619             :                                     }
    1620           0 :                                     break;
    1621             :                                     case PPT_TRANSITION_TYPE_PULL :
    1622             :                                     {
    1623           0 :                                         if ( nDirection == 0 )
    1624           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT );     // Nach links aufdecken
    1625           0 :                                         else if ( nDirection == 1 )
    1626           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP );      // Nach oben aufdecken
    1627           0 :                                         else if ( nDirection == 2 )
    1628           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT );    // Nach rechts aufdecken
    1629           0 :                                         else if ( nDirection == 3 )
    1630           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM );   // Nach unten aufdecken
    1631           0 :                                         else if ( nDirection == 4 )
    1632           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT );// Nach links oben aufdecken
    1633           0 :                                         else if ( nDirection == 5 )
    1634           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT );// Nach rechts oben aufdecken
    1635           0 :                                         else if ( nDirection == 6 )
    1636           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT );// Nach links unten aufdecken
    1637           0 :                                         else if ( nDirection == 7 )
    1638           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT );// Nach rechts unten aufdecken
    1639             :                                     }
    1640           0 :                                     break;
    1641             :                                     case PPT_TRANSITION_TYPE_WIPE :
    1642             :                                     {
    1643           0 :                                         if ( nDirection == 0 )
    1644           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT ); // Von rechts rollen
    1645           0 :                                         else if ( nDirection == 1 )
    1646           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM );// Von unten rollen
    1647           0 :                                         else if ( nDirection == 2 )
    1648           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT );  // Von links rollen
    1649           0 :                                         else if ( nDirection == 3 )
    1650           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP );   // Von oben rollen
    1651             :                                     }
    1652           0 :                                     break;
    1653             :                                     case PPT_TRANSITION_TYPE_RANDOM :
    1654           0 :                                         pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_RANDOM );              // Automatisch
    1655           0 :                                     break;
    1656             :                                     case PPT_TRANSITION_TYPE_FADE :
    1657             :                                     {
    1658           0 :                                         pPage->setTransitionType( animations::TransitionType::FADE );
    1659           0 :                                         pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
    1660           0 :                                         pPage->setTransitionFadeColor( 0 );
    1661             :                                     }
    1662           0 :                                     break;
    1663             :                                     case PPT_TRANSITION_TYPE_ZOOM :
    1664             :                                     {
    1665           0 :                                         if ( nDirection == 0 )
    1666           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER );// Von innen einblenden
    1667           0 :                                         else if ( nDirection == 1 )
    1668           0 :                                             pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER );  // Von aussen einblenden
    1669             :                                     }
    1670           0 :                                     break;
    1671             :                                     case PPT_TRANSITION_TYPE_DIAMOND :
    1672             :                                     {
    1673           0 :                                         pPage->setTransitionType( animations::TransitionType::IRISWIPE );
    1674           0 :                                         pPage->setTransitionSubtype( animations::TransitionSubType::DIAMOND );
    1675             :                                     }
    1676           0 :                                     break;
    1677             :                                     case PPT_TRANSITION_TYPE_PLUS :
    1678             :                                     {
    1679           0 :                                         pPage->setTransitionType( animations::TransitionType::FOURBOXWIPE );
    1680           0 :                                         pPage->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT );
    1681             :                                     }
    1682           0 :                                     break;
    1683             :                                     case PPT_TRANSITION_TYPE_CIRCLE :
    1684             :                                     {
    1685           0 :                                         pPage->setTransitionType( animations::TransitionType::ELLIPSEWIPE );
    1686           0 :                                         pPage->setTransitionSubtype( animations::TransitionSubType::CIRCLE );
    1687             :                                     }
    1688           0 :                                     break;
    1689             :                                     case PPT_TRANSITION_TYPE_WEDGE :
    1690             :                                     {
    1691           0 :                                         pPage->setTransitionType( animations::TransitionType::FANWIPE );
    1692           0 :                                         pPage->setTransitionSubtype( animations::TransitionSubType::CENTERTOP );
    1693             :                                     }
    1694           0 :                                     break;
    1695             :                                     case PPT_TRANSITION_TYPE_WHEEL :
    1696             :                                     {
    1697           0 :                                         pPage->setTransitionType( animations::TransitionType::PINWHEELWIPE );
    1698             :                                         sal_Int16 nSubType;
    1699           0 :                                         switch( nDirection )
    1700             :                                         {
    1701             :                                             default:
    1702           0 :                                             case 1 : nSubType = animations::TransitionSubType::ONEBLADE; break;
    1703           0 :                                             case 2 : nSubType = animations::TransitionSubType::TWOBLADEVERTICAL; break;
    1704           0 :                                             case 3 : nSubType = animations::TransitionSubType::THREEBLADE; break;
    1705           0 :                                             case 4 : nSubType = animations::TransitionSubType::FOURBLADE; break;
    1706           0 :                                             case 8 : nSubType = animations::TransitionSubType::EIGHTBLADE; break;
    1707             :                                         }
    1708           0 :                                         pPage->setTransitionSubtype( nSubType );
    1709             :                                     }
    1710           0 :                                     break;
    1711             :                                     case PPT_TRANSITION_TYPE_PUSH :
    1712             :                                     {
    1713           0 :                                         pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
    1714             :                                         sal_Int16 nSubType;
    1715           0 :                                         switch( nDirection )
    1716             :                                         {
    1717             :                                             default:
    1718           0 :                                             case 0 : nSubType = animations::TransitionSubType::FROMRIGHT; break;
    1719           0 :                                             case 1 : nSubType = animations::TransitionSubType::FROMBOTTOM; break;
    1720           0 :                                             case 2 : nSubType = animations::TransitionSubType::FROMLEFT; break;
    1721           0 :                                             case 3 : nSubType = animations::TransitionSubType::FROMTOP; break;
    1722             :                                         }
    1723           0 :                                         pPage->setTransitionSubtype( nSubType );
    1724             :                                     }
    1725           0 :                                     break;
    1726             :                                     case PPT_TRANSITION_TYPE_COMB :
    1727             :                                     {
    1728           0 :                                         pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
    1729           0 :                                         pPage->setTransitionSubtype( nDirection ? animations::TransitionSubType::COMBVERTICAL : animations::TransitionSubType::COMBHORIZONTAL );
    1730             :                                     }
    1731           0 :                                     break;
    1732             :                                     case PPT_TRANSITION_TYPE_NEWSFLASH :
    1733             :                                     {
    1734           0 :                                         pPage->setTransitionType( animations::TransitionType::ZOOM );
    1735           0 :                                         pPage->setTransitionSubtype( animations::TransitionSubType::ROTATEIN );
    1736             :                                     }
    1737           0 :                                     break;
    1738             :                                     case PPT_TRANSITION_TYPE_SMOOTHFADE :
    1739             :                                     {
    1740           0 :                                         pPage->setTransitionType( animations::TransitionType::FADE );
    1741           0 :                                         pPage->setTransitionSubtype( animations::TransitionSubType::CROSSFADE );
    1742             :                                     }
    1743           0 :                                     break;
    1744             :                                 }
    1745             : 
    1746           5 :                                 if ( nSpeed == 0 )
    1747           0 :                                     pPage->setTransitionDuration( 3.0 );        // langsam
    1748           5 :                                 else if ( nSpeed == 1 )
    1749           3 :                                     pPage->setTransitionDuration( 2.0 );    // mittel
    1750           2 :                                 else if ( nSpeed == 2 )
    1751           2 :                                     pPage->setTransitionDuration( 1.0 );    // schnell
    1752             : 
    1753           5 :                                 if ( nBuildFlags & 0x400 )                      // slidechange by time
    1754             :                                 {   // Standzeit (in Ticks)
    1755           0 :                                     pPage->SetPresChange( PRESCHANGE_AUTO );
    1756           0 :                                     pPage->SetTime( nSlideTime / 1000 );
    1757             :                                 }
    1758             :                                 else
    1759           5 :                                     pPage->SetPresChange( mePresChange );
    1760             : 
    1761           5 :                                 if ( nBuildFlags & 4 )
    1762           0 :                                     pPage->SetExcluded( sal_True );                 // Dia nicht anzeigen
    1763           5 :                                 if ( nBuildFlags & 16 )
    1764             :                                 {   // Dia mit Soundeffekt
    1765           3 :                                     pPage->SetSound( sal_True );
    1766           3 :                                     String aSoundFile( ReadSound( nSoundRef ) );
    1767           3 :                                     pPage->SetSoundFile( aSoundFile );
    1768             :                                 }
    1769           5 :                                 if ( nBuildFlags & ( 1 << 6 ) )     // Loop until next sound
    1770           0 :                                     pPage->SetLoopSound( sal_True );
    1771           5 :                                 if ( nBuildFlags & ( 1 << 8 ) )     // Stop the previous sound
    1772           0 :                                     pPage->SetStopSound( sal_True );
    1773             :                                 break;
    1774             :                             }
    1775             :                         }
    1776             :                     }
    1777         229 :                     aHd.SeekToEndOfRecord( rStCtrl );
    1778             :                 }
    1779          37 :                 if ( bTryTwice && ( bSSSlideInfoAtom == sal_False ) )
    1780             :                 {
    1781          27 :                     bTryTwice = sal_False;
    1782          27 :                     if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
    1783             :                     {
    1784          27 :                         sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
    1785          27 :                         PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
    1786          27 :                         if ( pPageList && ( nMasterNum < pPageList->size() ) )
    1787             :                         {
    1788          27 :                             PptSlidePersistEntry* pE = (*pPageList)[ nMasterNum ];
    1789          27 :                             if ( pE )
    1790             :                             {
    1791          27 :                                 sal_uInt32 nOfs = pE->aPersistAtom.nReserved;
    1792          27 :                                 if ( nOfs )
    1793             :                                 {
    1794           0 :                                     rStCtrl.Seek( nOfs );
    1795           0 :                                     nPageRecEnd = nOfs + 16;
    1796           0 :                                     continue;
    1797             :                                 }
    1798             :                             }
    1799             :                         }
    1800             : 
    1801             :                     }
    1802             :                 }
    1803          37 :                 break;
    1804             :             }
    1805             :         }
    1806             :     }
    1807             : 
    1808          41 :     if ( !bNewAnimationsUsed )
    1809             :     {
    1810          41 :         tAnimationVector aAnimationsOnThisPage;
    1811             : 
    1812             :         // add effects from page in correct order
    1813          41 :         SdrObjListIter aSdrIter( *pPage, IM_FLAT );
    1814         340 :         while ( aSdrIter.IsMore() )
    1815             :         {
    1816         258 :             SdrObject* pObj = aSdrIter.Next();
    1817         258 :             tAnimationMap::iterator aFound = maAnimations.find( pObj );
    1818         258 :             if( aFound != maAnimations.end() )
    1819             :             {
    1820          33 :                 std::pair< SdrObject*, Ppt97AnimationPtr > aPair( (*aFound).first, (*aFound).second );
    1821          33 :                 aAnimationsOnThisPage.push_back( aPair );
    1822             :             }
    1823             :         }
    1824             : 
    1825             :         Ppt97AnimationStlSortHelper aSortHelper;
    1826          41 :         std::sort( aAnimationsOnThisPage.begin(), aAnimationsOnThisPage.end(), aSortHelper );
    1827             : 
    1828          41 :         tAnimationVector::iterator aIter( aAnimationsOnThisPage.begin() );
    1829          41 :         const tAnimationVector::iterator aEnd( aAnimationsOnThisPage.end() );
    1830             : 
    1831          74 :         for( ;aIter != aEnd; ++aIter )
    1832             :         {
    1833          33 :             Ppt97AnimationPtr pPpt97Animation = (*aIter).second;;
    1834          33 :             if( pPpt97Animation.get() )
    1835          33 :                 pPpt97Animation->createAndSetCustomAnimationEffect( (*aIter).first );
    1836          74 :         }
    1837             :     }
    1838          41 :     rStCtrl.Seek( nFilePosMerk );
    1839          41 : }
    1840             : 
    1841             : //////////////////////////////////////////////////////////////////////////
    1842             : //
    1843             : // Import von Sounds
    1844             : //
    1845             : // Die Sounds werden nicht nur als String importiert sondern auch
    1846             : // in die Gallery einefuegt, falls dort noch nicht vorhanden.
    1847             : //
    1848             : ///////////////////////////////////////////////////////////////////////////
    1849             : 
    1850           3 : String ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const
    1851             : {
    1852           3 :     rtl::OUString aRetval;
    1853           3 :     sal_uInt32 nPosMerk = rStCtrl.Tell();
    1854           3 :     DffRecordHeader aDocHd;
    1855           3 :     if ( SeekToDocument( &aDocHd ) )
    1856             :     {
    1857           3 :         sal_uInt32 nSoundLen = aDocHd.GetRecEndFilePos();
    1858           3 :         DffRecordHeader aSoundBlockRecHd;
    1859           3 :         if( SeekToRec( rStCtrl, PPT_PST_SoundCollection, nSoundLen, &aSoundBlockRecHd ) )
    1860             :         {
    1861           0 :             sal_uInt32 nDataLen = aSoundBlockRecHd.GetRecEndFilePos();
    1862           0 :             DffRecordHeader aSoundRecHd;
    1863           0 :             sal_Bool bRefStrValid = sal_False;
    1864           0 :             sal_Bool bDone = sal_False;
    1865             : 
    1866           0 :             while( !bDone && SeekToRec( rStCtrl, PPT_PST_Sound, nDataLen, &aSoundRecHd ) )
    1867             :             {
    1868           0 :                 sal_uInt32 nStrLen = aSoundRecHd.GetRecEndFilePos();
    1869           0 :                 rtl::OUString aRefStr;
    1870           0 :                 sal_uInt32 nPosMerk2 = rStCtrl.Tell();
    1871           0 :                 if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 2 ) )
    1872             :                 {
    1873           0 :                     if ( ReadString( aRefStr ) )
    1874           0 :                         bRefStrValid = sal_True;
    1875             :                 }
    1876           0 :                 if ( bRefStrValid )
    1877             :                 {
    1878           0 :                     if ( rtl::OUString::valueOf(static_cast<sal_Int32>(nSoundRef)) == aRefStr )
    1879             :                     {
    1880           0 :                         rStCtrl.Seek( nPosMerk2 );
    1881           0 :                         if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 0 ) )
    1882             :                         {
    1883           0 :                             ReadString( aRetval );
    1884           0 :                             bDone = sal_True;
    1885             :                         }
    1886             :                     }
    1887             :                 }
    1888           0 :                 if ( bDone )
    1889             :                 {
    1890             :                     // ueberpruefen, ob diese Sound-Datei schon
    1891             :                     // existiert. Wenn nicht, exportiere diese
    1892             :                     // in unser lokales Sound-Verzeichnis.
    1893           0 :                     sal_Bool    bSoundExists = sal_False;
    1894           0 :                     ::std::vector< String > aSoundList;
    1895             : 
    1896           0 :                     GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, aSoundList );
    1897           0 :                     GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, aSoundList );
    1898             : 
    1899           0 :                     for( size_t n = 0; ( n < aSoundList.size() ) && !bSoundExists; ++n )
    1900             :                     {
    1901           0 :                         INetURLObject   aURL( aSoundList[ n ] );
    1902             : 
    1903           0 :                         if( aURL.GetName() == aRetval )
    1904             :                         {
    1905           0 :                             aRetval = aSoundList[ n ];
    1906           0 :                             bSoundExists = sal_True;
    1907             :                         }
    1908           0 :                     }
    1909             : 
    1910           0 :                     aSoundList.clear();
    1911             : 
    1912           0 :                     if ( !bSoundExists )
    1913             :                     {
    1914           0 :                         rStCtrl.Seek( nPosMerk2 );
    1915           0 :                         DffRecordHeader aSoundDataRecHd;
    1916           0 :                         if ( SeekToRec( rStCtrl, PPT_PST_SoundData, nStrLen, &aSoundDataRecHd, 0 ) )
    1917             :                         {
    1918           0 :                             String          aGalleryDir( SvtPathOptions().GetGalleryPath() );
    1919           0 :                             INetURLObject   aGalleryUserSound( aGalleryDir.GetToken( comphelper::string::getTokenCount(aGalleryDir, ';') - 1 ) );
    1920             : 
    1921           0 :                             aGalleryUserSound.Append( aRetval );
    1922           0 :                             sal_uInt32 nSoundDataLen = aSoundDataRecHd.nRecLen;
    1923           0 :                             sal_uInt8* pBuf = new sal_uInt8[ nSoundDataLen ];
    1924             : 
    1925           0 :                             rStCtrl.Read( pBuf, nSoundDataLen );
    1926           0 :                             SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
    1927             : 
    1928           0 :                             if( pOStm )
    1929             :                             {
    1930           0 :                                 pOStm->Write( pBuf, nSoundDataLen );
    1931             : 
    1932           0 :                                 if( pOStm->GetError() == ERRCODE_NONE )
    1933             :                                 {
    1934           0 :                                     GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ) );
    1935           0 :                                     aRetval = aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE );
    1936             :                                 }
    1937             : 
    1938           0 :                                 delete pOStm;
    1939             :                             }
    1940             : 
    1941           0 :                             delete[] pBuf;
    1942             :                         }
    1943           0 :                     }
    1944             :                 }
    1945           0 :                 if ( !bDone )
    1946           0 :                     aSoundRecHd.SeekToEndOfRecord( rStCtrl );
    1947           0 :             }
    1948             :         }
    1949             :     }
    1950           3 :     rStCtrl.Seek( nPosMerk );
    1951           3 :     return aRetval;
    1952             : }
    1953             : 
    1954             : //////////////////////////////////////////////////////////////////////////
    1955             : //
    1956             : // media object import, the return value is the url to the media object
    1957             : //
    1958             : //////////////////////////////////////////////////////////////////////////
    1959             : 
    1960           0 : String ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
    1961             : {
    1962           0 :     rtl::OUString aRetVal;
    1963           0 :     DffRecordHeader* pHd( const_cast<ImplSdPPTImport*>(this)->aDocRecManager.GetRecordHeader( PPT_PST_ExObjList, SEEK_FROM_BEGINNING ) );
    1964           0 :     if ( pHd )
    1965             :     {
    1966           0 :         pHd->SeekToContent( rStCtrl );
    1967           0 :         while ( ( rStCtrl.Tell() < pHd->GetRecEndFilePos() ) && aRetVal.isEmpty() )
    1968             :         {
    1969           0 :             DffRecordHeader aHdMovie;
    1970           0 :             rStCtrl >> aHdMovie;
    1971           0 :             switch( aHdMovie.nRecType )
    1972             :             {
    1973             :                 case PPT_PST_ExAviMovie :
    1974             :                 case PPT_PST_ExMCIMovie :
    1975             :                 {
    1976           0 :                     DffRecordHeader aExVideoHd;
    1977           0 :                     if ( SeekToRec( rStCtrl, PPT_PST_ExVideo, aHdMovie.GetRecEndFilePos(), &aExVideoHd ) )
    1978             :                     {
    1979           0 :                         DffRecordHeader aExMediaAtomHd;
    1980           0 :                         if ( SeekToRec( rStCtrl, PPT_PST_ExMediaAtom, aExVideoHd.GetRecEndFilePos(), &aExMediaAtomHd ) )
    1981             :                         {
    1982             :                             sal_uInt32 nRef;
    1983           0 :                             rStCtrl >> nRef;
    1984           0 :                             if ( nRef == nMediaRef )
    1985             :                             {
    1986           0 :                                 aExVideoHd.SeekToContent( rStCtrl );
    1987           0 :                                 while( rStCtrl.Tell() < aExVideoHd.GetRecEndFilePos() )
    1988             :                                 {
    1989           0 :                                     DffRecordHeader aHd;
    1990           0 :                                     rStCtrl >> aHd;
    1991           0 :                                     switch( aHd.nRecType )
    1992             :                                     {
    1993             :                                         case PPT_PST_CString :
    1994             :                                         {
    1995           0 :                                             aHd.SeekToBegOfRecord( rStCtrl );
    1996           0 :                                             rtl::OUString aStr;
    1997           0 :                                             if ( ReadString( aStr ) )
    1998             :                                             {
    1999           0 :                                                 if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aStr, aRetVal ) )
    2000             :                                                 {
    2001           0 :                                                     aRetVal = INetURLObject( aRetVal ).GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
    2002             :                                                 }
    2003           0 :                                             }
    2004             :                                         }
    2005           0 :                                         break;
    2006             :                                     }
    2007           0 :                                     aHd.SeekToEndOfRecord( rStCtrl );
    2008             :                                 }
    2009             :                                 break;
    2010             :                             }
    2011             :                         }
    2012             :                     }
    2013             :                 }
    2014           0 :                 break;
    2015             :             }
    2016           0 :             aHdMovie.SeekToEndOfRecord( rStCtrl );
    2017             :         }
    2018             :     }
    2019           0 :     return aRetVal;
    2020             : }
    2021             : 
    2022             : //////////////////////////////////////////////////////////////////////////
    2023             : //
    2024             : // Import von Objekten
    2025             : //
    2026             : //////////////////////////////////////////////////////////////////////////
    2027             : 
    2028           0 : void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, String aMacroName )
    2029             : {
    2030             :     // Lokale Informationen in pInfo eintragen
    2031           0 :     if( pIAtom->nSoundRef )
    2032             :     {
    2033           0 :         pInfo->SetBookmark( ReadSound( pIAtom->nSoundRef ) );   // Pfad zum Soundfile in MSDOS-Notation
    2034           0 :         pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_SOUND;           // RunProgramAction
    2035             :     }
    2036             : 
    2037           0 :     switch ( pIAtom->nAction )
    2038             :     {
    2039             : 
    2040             :         case 0x02 :                                         // RunProgramAction
    2041             :         {
    2042           0 :             pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
    2043           0 :             pInfo->SetBookmark( aMacroName );                   // Programmname in aBookmark
    2044             :         }
    2045           0 :         break;
    2046             :         case 0x03 :                                         // JumpAction
    2047             :         {
    2048           0 :             switch( pIAtom->nJump )
    2049             :             {
    2050             :                 case 0x01 :
    2051           0 :                     pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NEXTPAGE;        // Next slide
    2052           0 :                 break;
    2053             :                 case 0x02 :
    2054           0 :                     pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE;        // Previous slide
    2055           0 :                 break;
    2056             :                 case 0x03 :
    2057           0 :                     pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_FIRSTPAGE;       // First slide
    2058           0 :                 break;
    2059             :                 case 0x04 :
    2060           0 :                     pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_LASTPAGE;        // last Slide
    2061           0 :                 break;
    2062             :                 case 0x05 :
    2063           0 :                     pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE;        // Last slide viewed
    2064           0 :                 break;
    2065             :                 case 0x06 :
    2066           0 :                     pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_STOPPRESENTATION; // End show
    2067           0 :                 break;
    2068             :                 default :
    2069           0 :                     pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NONE;            // 0x00: no action, else unknown
    2070           0 :                 break;
    2071             :             }
    2072             :         }
    2073           0 :         break;
    2074             :         case 0x04 :
    2075             :         {
    2076           0 :             SdHyperlinkEntry* pPtr = NULL;
    2077           0 :             for ( size_t i = 0, n = aHyperList.size(); i < n; ++i ) {
    2078           0 :                 if ( aHyperList[ i ]->nIndex == pIAtom->nExHyperlinkId ) {
    2079           0 :                     pPtr = aHyperList[ i ];
    2080           0 :                     break;
    2081             :                 }
    2082             :             }
    2083           0 :             if ( pPtr )
    2084             :             {
    2085           0 :                 switch( pIAtom->nHyperlinkType )
    2086             :                 {
    2087             :                     case 9:
    2088             :                     case 8:                                         // hyperlink : URL
    2089             :                     {
    2090           0 :                         if ( pPtr->aTarget.Len() )
    2091             :                         {
    2092           0 :                             ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
    2093           0 :                             if ( pDocShell )
    2094             :                             {
    2095           0 :                                 String aBaseURL = pDocShell->GetMedium()->GetBaseURL();
    2096           0 :                                 String aBookmarkURL( pInfo->GetBookmark() );
    2097           0 :                                 INetURLObject aURL( pPtr->aTarget );
    2098           0 :                                 if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
    2099           0 :                                     utl::LocalFileHelper::ConvertSystemPathToURL( pPtr->aTarget, aBaseURL, aBookmarkURL );
    2100           0 :                                 if( !aBookmarkURL.Len() )
    2101           0 :                                     aBookmarkURL = URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pPtr->aTarget, URIHelper::GetMaybeFileHdl(), true );
    2102           0 :                                 pInfo->SetBookmark( aBookmarkURL );
    2103           0 :                                 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
    2104             :                             }
    2105             :                         }
    2106             :                     }
    2107           0 :                     break;
    2108             : 
    2109             :                     case 10:
    2110           0 :                     break;
    2111             : 
    2112             :                     case 7:                                         // hyperlink auf eine Seite
    2113             :                     {
    2114           0 :                         if ( pPtr->aConvSubString.Len() )
    2115             :                         {
    2116           0 :                             pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_BOOKMARK;
    2117           0 :                             pInfo->SetBookmark( pPtr->aConvSubString );
    2118             :                         }
    2119             :                     }
    2120           0 :                     break;
    2121             :                 }
    2122             :             }
    2123             :         }
    2124           0 :         break;
    2125             :         case 0x05 :                     // OLEAction ( OLEVerb to use, 0==first, 1==secnd, .. )
    2126             :         case 0x06 :                     // MediaAction
    2127             :         case 0x07 :                     // CustomShowAction
    2128             :         default :                       // 0x00: no action, else unknown action
    2129           0 :         break;
    2130             :     }
    2131           0 : }
    2132             : 
    2133         604 : SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj, SdPage* pPage,
    2134             :                                         SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
    2135             : {
    2136             :     SfxStyleSheet*  pStyleSheetAry[ 9 ];
    2137         604 :     SdrTextObj*     pText = pObj;
    2138         604 :     SdrObject*      pRet = pText;
    2139             : 
    2140         604 :     ppStyleSheetAry = NULL;
    2141             : 
    2142         604 :     PresObjKind ePresKind = PRESOBJ_NONE;
    2143         604 :     PptOEPlaceholderAtom* pPlaceHolder = pTextObj->GetOEPlaceHolderAtom();
    2144         604 :     String aPresentationText;
    2145         604 :     if ( pPlaceHolder )
    2146             :     {
    2147         130 :         switch( pPlaceHolder->nPlaceholderId )
    2148             :         {
    2149             :             case PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE :
    2150             :             case PPT_PLACEHOLDER_MASTERCENTEREDTITLE :
    2151             :             case PPT_PLACEHOLDER_MASTERTITLE :
    2152             :             {
    2153           9 :                 ePresKind = PRESOBJ_TITLE;
    2154           9 :                 aPresentationText = pPage->GetPresObjText( ePresKind );
    2155             :             }
    2156           9 :             break;
    2157             :             case PPT_PLACEHOLDER_MASTERBODY :
    2158             :             {
    2159           5 :                 ePresKind = PRESOBJ_OUTLINE;
    2160           5 :                 aPresentationText = pPage->GetPresObjText( ePresKind );
    2161             :             }
    2162           5 :             break;
    2163             :             case PPT_PLACEHOLDER_MASTERSUBTITLE :
    2164             :             {
    2165           0 :                 ePresKind = PRESOBJ_TEXT;
    2166           0 :                 aPresentationText = pPage->GetPresObjText( ePresKind );
    2167             :             }
    2168           0 :             break;
    2169             :             case PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE :
    2170             :             {
    2171           4 :                 ePresKind = PRESOBJ_NOTES;
    2172           4 :                 aPresentationText = pPage->GetPresObjText( ePresKind );
    2173             :             }
    2174           4 :             break;
    2175          10 :             case PPT_PLACEHOLDER_MASTERDATE :           ePresKind = PRESOBJ_DATETIME;   break;
    2176           9 :             case PPT_PLACEHOLDER_MASTERSLIDENUMBER :    ePresKind = PRESOBJ_SLIDENUMBER;break;
    2177          10 :             case PPT_PLACEHOLDER_MASTERFOOTER :         ePresKind = PRESOBJ_FOOTER;     break;
    2178           5 :             case PPT_PLACEHOLDER_MASTERHEADER :         ePresKind = PRESOBJ_HEADER;     break;
    2179             :         }
    2180             :     }
    2181         604 :     switch ( pTextObj->GetDestinationInstance() )
    2182             :     {
    2183             :         case TSS_TYPE_PAGETITLE :
    2184             :         case TSS_TYPE_TITLE :
    2185             :         {
    2186          37 :             pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
    2187          37 :             if ( pSheet )
    2188          37 :                 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
    2189             :             DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
    2190             :         }
    2191          37 :         break;
    2192             :         case TSS_TYPE_SUBTITLE :
    2193             :         {
    2194           2 :             pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
    2195           2 :             if ( pSheet )
    2196           2 :                 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
    2197             :             DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" );
    2198             :         }
    2199           2 :         break;
    2200             :         case TSS_TYPE_BODY :
    2201             :         case TSS_TYPE_HALFBODY :
    2202             :         case TSS_TYPE_QUARTERBODY :
    2203             :         {
    2204         270 :             for ( sal_uInt16 nLevel = 9; nLevel; nLevel-- )
    2205             :             {
    2206         243 :                 String aName( pPage->GetLayoutName() );
    2207         243 :                 aName.Append( (sal_Unicode)( ' ' ) );
    2208         243 :                 aName.Append( String::CreateFromInt32( nLevel ) );
    2209         243 :                 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
    2210         243 :                 if ( pSheet )
    2211         243 :                     pText->StartListening( *pSheet );
    2212         243 :                 pStyleSheetAry[ nLevel - 1 ] = pSheet;
    2213         243 :             }
    2214             :             DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for outlinerobject (SJ)" );
    2215          27 :             if ( pSheet )
    2216          27 :                 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
    2217          27 :             ppStyleSheetAry = &pStyleSheetAry[ 0 ];
    2218             :         }
    2219          27 :         break;
    2220             :         case TSS_TYPE_NOTES :
    2221             :         {
    2222          27 :             if ( pPlaceHolder && ( ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_NOTESSLIDEIMAGE )
    2223             :                 || ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) ) )
    2224             :             {
    2225           4 :                 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
    2226           4 :                 if ( pSheet )
    2227           4 :                     ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
    2228           4 :                 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
    2229             :             }
    2230             :             else
    2231             :             {
    2232          23 :                 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
    2233             :                 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for notesobj (SJ)" );
    2234          23 :                 if ( pSheet )
    2235          23 :                     ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, sal_True );
    2236             :             }
    2237             :         }
    2238          27 :         break;
    2239             :         case TSS_TYPE_UNUSED :
    2240             :         case TSS_TYPE_TEXT_IN_SHAPE :
    2241             :         {
    2242         511 :             switch( ePresKind )
    2243             :             {
    2244             :                 case PRESOBJ_DATETIME :
    2245             :                 case PRESOBJ_SLIDENUMBER :
    2246             :                 case PRESOBJ_FOOTER :
    2247             :                 case PRESOBJ_HEADER :
    2248          34 :                     pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
    2249          34 :                 break;
    2250             :                 default :
    2251         477 :                     pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
    2252             :             }
    2253             :         }
    2254         511 :         break;
    2255             :     }
    2256         604 :     pText = (SdrTextObj*)SdrPowerPointImport::ApplyTextObj( pTextObj, pText, pPage, pSheet, ppStyleSheetAry );
    2257         604 :     if ( pPlaceHolder && pPlaceHolder->nPlaceholderId )
    2258             :     {
    2259         130 :         if ( eAktPageKind == PPT_MASTERPAGE )
    2260             :         {
    2261          48 :             sal_Bool bCreatePlaceHolder = ( pTextObj->GetInstance() != TSS_TYPE_SUBTITLE ) && ( pTextObj->GetInstance() != TSS_TYPE_UNUSED );
    2262             :             sal_Bool bIsHeaderFooter = ( ePresKind == PRESOBJ_HEADER) || (ePresKind == PRESOBJ_FOOTER)
    2263          48 :                                         || (ePresKind == PRESOBJ_DATETIME) || (ePresKind == PRESOBJ_SLIDENUMBER);
    2264          48 :             if ( bCreatePlaceHolder && ( pTextObj->GetInstance() == TSS_TYPE_TEXT_IN_SHAPE ) )
    2265          30 :                 bCreatePlaceHolder = bIsHeaderFooter;
    2266          48 :             if ( bCreatePlaceHolder )
    2267             :             {
    2268          48 :                 if ( !bIsHeaderFooter )
    2269             :                 {
    2270          18 :                     pText->SetNotVisibleAsMaster( sal_True );
    2271          18 :                     pText->SetEmptyPresObj( sal_True );
    2272             :                 }
    2273          48 :                 pText->SetUserCall( pPage );
    2274          48 :                 pPage->InsertPresObj( pText, ePresKind );
    2275          48 :                 SdrOutliner* pOutl = NULL;
    2276          48 :                 if ( pTextObj->GetInstance() == TSS_TYPE_NOTES )
    2277           8 :                     pOutl = GetDrawOutliner( pText );
    2278          48 :                 if ( aPresentationText.Len() )
    2279          18 :                     pPage->SetObjText( (SdrTextObj*)pText, pOutl, ePresKind, aPresentationText );
    2280             : 
    2281          48 :                 if ( pPage->GetPageKind() != PK_NOTES )
    2282             :                 {
    2283          25 :                     SfxStyleSheet* pSheet2( pPage->GetStyleSheetForPresObj( ePresKind ) );
    2284          25 :                     if ( pSheet2 )
    2285             :                     {
    2286          25 :                         SfxItemSet& rItemSet = pSheet2->GetItemSet();
    2287          25 :                         rItemSet.Put( (SdrTextLeftDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LEFTDIST ) );
    2288          25 :                         rItemSet.Put( (SdrTextRightDistItem&)pText->GetMergedItem( SDRATTR_TEXT_RIGHTDIST ) );
    2289          25 :                         rItemSet.Put( (SdrTextUpperDistItem&)pText->GetMergedItem( SDRATTR_TEXT_UPPERDIST ) );
    2290          25 :                         rItemSet.Put( (SdrTextLowerDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LOWERDIST ) );
    2291          25 :                         rItemSet.Put( (SdrTextVertAdjustItem&)pText->GetMergedItem( SDRATTR_TEXT_VERTADJUST ) );
    2292          25 :                         rItemSet.Put( (SdrTextHorzAdjustItem&)pText->GetMergedItem( SDRATTR_TEXT_HORZADJUST ) );
    2293             :                     }
    2294          25 :                     pText->NbcSetStyleSheet( pSheet2, sal_False );
    2295             :                 }
    2296             : 
    2297          48 :                 SfxItemSet aTempAttr( mpDoc->GetPool() );
    2298          48 :                 SdrTextMinFrameHeightItem aMinHeight( pText->GetLogicRect().GetSize().Height() );
    2299          48 :                 aTempAttr.Put( aMinHeight );
    2300          48 :                 SdrTextAutoGrowHeightItem aAutoGrowHeight( sal_False );
    2301          48 :                 aTempAttr.Put( aAutoGrowHeight );
    2302          48 :                 pText->SetMergedItemSet(aTempAttr);
    2303             :             }
    2304             :             else
    2305             :             {
    2306           0 :                 pRet = NULL;
    2307             :             }
    2308             :         }
    2309             :         else
    2310             :         {
    2311          82 :             const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
    2312          82 :             if ( pSlideLayout || ( eAktPageKind == PPT_NOTEPAGE ) )
    2313             :             {
    2314          82 :                 sal_Int16 nPlaceholderId = pPlaceHolder->nPlaceholderId;
    2315          82 :                 sal_uInt16 i = 0;
    2316          82 :                 if ( eAktPageKind == PPT_SLIDEPAGE )
    2317             :                 {
    2318          86 :                     for ( ; i < 8; i++ )
    2319             :                     {
    2320          86 :                         if ( pSlideLayout->aPlaceholderId[ i ] == nPlaceholderId )
    2321          59 :                             break;
    2322             :                     }
    2323             :                 }
    2324          82 :                 if ( i < 8 )
    2325             :                 {
    2326          82 :                     PresObjKind ePresObjKind = PRESOBJ_NONE;
    2327          82 :                     sal_Bool    bEmptyPresObj = sal_True;
    2328          82 :                     sal_Bool    bVertical = sal_False;
    2329          82 :                     if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
    2330             :                     {
    2331          79 :                         if ( pTextObj->Count() )
    2332          72 :                             bEmptyPresObj = sal_False;
    2333          79 :                         switch ( nPlaceholderId )
    2334             :                         {
    2335          19 :                             case PPT_PLACEHOLDER_NOTESBODY :            ePresObjKind = PRESOBJ_NOTES;   break;
    2336             :                             case PPT_PLACEHOLDER_VERTICALTEXTTITLE :
    2337           0 :                                 bVertical = sal_True;   // PASSTHROUGH !!!
    2338          30 :                             case PPT_PLACEHOLDER_TITLE :                ePresObjKind = PRESOBJ_TITLE;   break;
    2339             :                             case PPT_PLACEHOLDER_VERTICALTEXTBODY :
    2340           0 :                                 bVertical = sal_True;   // PASSTHROUGH !!!
    2341          22 :                             case PPT_PLACEHOLDER_BODY :                 ePresObjKind = PRESOBJ_OUTLINE; break;
    2342           2 :                             case PPT_PLACEHOLDER_CENTEREDTITLE :        ePresObjKind = PRESOBJ_TITLE;   break;
    2343           2 :                             case PPT_PLACEHOLDER_SUBTITLE :             ePresObjKind = PRESOBJ_TEXT;    break;      // PRESOBJ_OUTLINE
    2344             : 
    2345             :                             default :
    2346             :                             {
    2347           4 :                                 if ( !pTextObj->Count() )
    2348             :                                 {
    2349           0 :                                     switch ( nPlaceholderId )
    2350             :                                     {
    2351             :                                         case PPT_PLACEHOLDER_MEDIACLIP :
    2352           0 :                                         case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
    2353           0 :                                         case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
    2354           0 :                                         case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_TABLE; break;
    2355           0 :                                         case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
    2356           0 :                                         case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
    2357             :                                     }
    2358             :                                 }
    2359             :                             };
    2360             :                         }
    2361             :                     }
    2362           3 :                     else if ( pTextObj->GetShapeType() == mso_sptPictureFrame )
    2363             :                     {
    2364           3 :                         if ( !pTextObj->Count() && pObj->ISA( SdrGrafObj ) )
    2365             :                         {
    2366           0 :                             bEmptyPresObj = sal_False;
    2367           0 :                             switch ( nPlaceholderId )
    2368             :                             {
    2369             :                                 case PPT_PLACEHOLDER_MEDIACLIP :
    2370           0 :                                 case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
    2371           0 :                                 case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
    2372           0 :                                 case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_CALC; break;
    2373           0 :                                 case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
    2374           0 :                                 case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
    2375             :                             }
    2376             :                         }
    2377             :                     }
    2378          82 :                     if ( ePresObjKind != PRESOBJ_NONE )
    2379             :                     {
    2380          75 :                         if ( !bEmptyPresObj )
    2381             :                         {
    2382          68 :                             pPage->InsertPresObj( pRet, ePresObjKind );
    2383             :                         }
    2384             :                         else
    2385             :                         {
    2386           7 :                             SdrObject* pPresObj = pPage->CreatePresObj( ePresObjKind, bVertical, pText->GetLogicRect(), sal_True );
    2387           7 :                             pPresObj->SetUserCall( pPage );
    2388             : 
    2389           7 :                             SfxItemSet aSet( pSdrModel->GetItemPool() );
    2390           7 :                             ApplyAttributes( rStCtrl, aSet );
    2391           7 :                             pPresObj->SetMergedItemSet(aSet);
    2392             : 
    2393           7 :                             if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( pSlideLayout->aPlacementId[ i ] != (sal_uLong)-1 ) )
    2394             :                             {
    2395           5 :                                 SdrObject* pTitleObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
    2396           5 :                                 SdrObject* pOutlineObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
    2397             : 
    2398           5 :                                 Rectangle aTitleRect;
    2399           5 :                                 Rectangle aOutlineRect;
    2400           5 :                                 Size      aOutlineSize;
    2401             : 
    2402           5 :                                 if ( pTitleObj )
    2403           5 :                                     aTitleRect = pTitleObj->GetLogicRect();
    2404           5 :                                 if ( pOutlineObj )
    2405             :                                 {
    2406           5 :                                     aOutlineRect = pOutlineObj->GetLogicRect();
    2407           5 :                                     aOutlineSize = aOutlineRect.GetSize();
    2408             :                                 }
    2409           5 :                                 Rectangle aLogicRect( pPresObj->GetLogicRect() );
    2410           5 :                                 Size      aLogicSize( aLogicRect.GetSize() );
    2411             : 
    2412           5 :                                 switch ( pSlideLayout->aPlacementId[ i ] )
    2413             :                                 {
    2414             :                                     case 0 :            // Lage im Titelbereich
    2415             :                                     {
    2416           5 :                                         if ( aLogicRect != aTitleRect )
    2417           5 :                                             pPresObj->SetUserCall( NULL );
    2418             :                                     }
    2419           5 :                                     break;
    2420             : 
    2421             :                                     case 1:
    2422             :                                     {
    2423           0 :                                         if ( pSlideLayout->eLayout == PPT_LAYOUT_TITLEANDBODYSLIDE )
    2424             :                                         {   // Lage im Outlinebereich
    2425           0 :                                             if ( aLogicRect != aOutlineRect )
    2426           0 :                                                 pPresObj->SetUserCall( NULL );
    2427             :                                         }
    2428           0 :                                         else if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
    2429             :                                         {   // Lage im Outlinebereich links
    2430           0 :                                             if (Abs(aLogicRect.Left()   - aOutlineRect.Left())   > MAX_USER_MOVE ||
    2431           0 :                                                 Abs(aLogicRect.Top()    - aOutlineRect.Top())    > MAX_USER_MOVE ||
    2432           0 :                                                 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
    2433           0 :                                                     aLogicSize.Width()  / aOutlineSize.Width()   < 0.48          ||
    2434           0 :                                                     aLogicSize.Width()  / aOutlineSize.Width()   > 0.5)
    2435             :                                             {
    2436           0 :                                                 pPresObj->SetUserCall(NULL);
    2437             :                                             }
    2438             :                                         }
    2439           0 :                                         else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
    2440             :                                         {   // Lage im Outlinebereich oben
    2441           0 :                                             if (Abs(aLogicRect.Left()  - aOutlineRect.Left())  > MAX_USER_MOVE ||
    2442           0 :                                                 Abs(aLogicRect.Top()   - aOutlineRect.Top())   > MAX_USER_MOVE ||
    2443           0 :                                                 Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
    2444             :                                             {
    2445           0 :                                                 pPresObj->SetUserCall( NULL );
    2446             :                                             }
    2447             :                                         }
    2448           0 :                                         else if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
    2449           0 :                                                  Abs(aLogicRect.Top()  - aOutlineRect.Top())  > MAX_USER_MOVE)
    2450             :                                         {   // Lage im Outlinebereich links oben
    2451           0 :                                             pPresObj->SetUserCall( NULL );
    2452             :                                         }
    2453             :                                     }
    2454           0 :                                     break;
    2455             : 
    2456             :                                     case 2:
    2457             :                                     {
    2458           0 :                                         if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
    2459             :                                         {   // Lage im Outlinebereich rechts
    2460           0 :                                             if (Abs(aLogicRect.Right()  - aOutlineRect.Right())  > MAX_USER_MOVE ||
    2461           0 :                                                 Abs(aLogicRect.Top()    - aOutlineRect.Top())    > MAX_USER_MOVE ||
    2462           0 :                                                 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
    2463           0 :                                                     aLogicSize.Width()  / aOutlineSize.Width()   < 0.48          ||
    2464           0 :                                                     aLogicSize.Width()  / aOutlineSize.Width()   > 0.5)
    2465             :                                             {
    2466           0 :                                                 pPresObj->SetUserCall( NULL );
    2467             :                                             }
    2468             :                                         }
    2469           0 :                                         else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
    2470             :                                         {   // Lage im Outlinebereich unten
    2471           0 :                                             if (Abs(aLogicRect.Left()   - aOutlineRect.Left())   > MAX_USER_MOVE ||
    2472           0 :                                                 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
    2473           0 :                                                 Abs(aLogicRect.Right()  - aOutlineRect.Right())  > MAX_USER_MOVE)
    2474             :                                             {
    2475           0 :                                                 pPresObj->SetUserCall( NULL );
    2476             :                                             }
    2477             :                                         }
    2478           0 :                                         else if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
    2479           0 :                                                  Abs(aLogicRect.Top()   - aOutlineRect.Top())   > MAX_USER_MOVE)
    2480             :                                         {   // Lage im Outlinebereich rechts oben
    2481           0 :                                             pPresObj->SetUserCall(NULL);
    2482             :                                         }
    2483             :                                     }
    2484           0 :                                     break;
    2485             : 
    2486             :                                     case 3:
    2487             :                                     {   // Lage im Outlinebereich links unten
    2488           0 :                                         if (Abs(aLogicRect.Left()   - aOutlineRect.Left())   > MAX_USER_MOVE ||
    2489           0 :                                             Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
    2490             :                                         {
    2491           0 :                                             pPresObj->SetUserCall( NULL );
    2492             :                                         }
    2493             :                                     }
    2494           0 :                                     break;
    2495             : 
    2496             :                                     case 4:
    2497             :                                     {   // Lage im Outlinebereich rechts unten
    2498           0 :                                         if (Abs(aLogicRect.Right() - aOutlineRect.Right())   > MAX_USER_MOVE ||
    2499           0 :                                             Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
    2500             :                                         {
    2501           0 :                                             pObj->SetUserCall( NULL );
    2502             :                                         }
    2503             :                                     }
    2504           0 :                                     break;
    2505             :                                 }
    2506             :                             }
    2507           7 :                             pRet = NULL;    // return zero cause this obj was already inserted by CreatePresObj
    2508             :                         }
    2509             :                     }
    2510           7 :                     else if ( !pTextObj->Count() )
    2511           3 :                         pRet = NULL;
    2512             :                 }
    2513             :             }
    2514             :         }
    2515             :     }
    2516         604 :     if ( pRet != pText )
    2517             :     {
    2518          10 :         SdrObject* pFree( pText );
    2519          10 :         SdrObject::Free( pFree );
    2520             :     }
    2521         604 :     return pRet;
    2522             : }
    2523             : 
    2524        1240 : SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pRet )
    2525             : {
    2526        1240 :     SdrObject* pObj = SdrPowerPointImport::ProcessObj( rSt, rObjData, pData, rTextRect, pRet );
    2527             : 
    2528             :     // Animationseffekte des Objektes lesen
    2529        1240 :     if ( pObj )
    2530             :     {
    2531             :         // further setup placeholder objects
    2532        1233 :         if( pObj->ISA(SdrPageObj) && pData )
    2533             :         {
    2534          18 :             const ProcessData* pProcessData=(const ProcessData*)pData;
    2535          18 :             if( pProcessData->pPage )
    2536          18 :                 pProcessData->pPage->InsertPresObj( pObj, PRESOBJ_PAGE );
    2537             :         }
    2538             : 
    2539        1233 :         sal_Bool bInhabitanceChecked = sal_False;
    2540        1233 :         sal_Bool bAnimationInfoFound = sal_False;
    2541        1233 :         DffRecordHeader aMasterShapeHd;
    2542             : 
    2543        1233 :         if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
    2544             :         {
    2545         178 :             DffRecordHeader& rHdClientData = *maShapeRecords.Current();
    2546          83 :             while( sal_True )
    2547             :             {
    2548         261 :                 sal_uInt32 nClientDataLen = rHdClientData.GetRecEndFilePos();
    2549         261 :                 DffRecordHeader aHd;
    2550         532 :                 do
    2551             :                 {
    2552         266 :                     rSt >> aHd;
    2553         266 :                     sal_uInt32 nHdRecEnd = aHd.GetRecEndFilePos();
    2554         266 :                     switch ( aHd.nRecType )
    2555             :                     {
    2556             :                         case PPT_PST_AnimationInfo :
    2557             :                         {
    2558          39 :                             DffRecordHeader aHdAnimInfoAtom;
    2559          39 :                             if ( SeekToRec( rSt, PPT_PST_AnimationInfoAtom, nHdRecEnd, &aHdAnimInfoAtom ) )
    2560             :                             {
    2561             :                                 // read data from stream
    2562          39 :                                 Ppt97AnimationPtr pAnimation( new Ppt97Animation( rSt ) );
    2563             :                                 // store animation informations
    2564          39 :                                 if( pAnimation->HasEffect() )
    2565             :                                 {
    2566             :                                     // translate color to RGB
    2567          39 :                                     pAnimation->SetDimColor( MSO_CLR_ToColor(pAnimation->GetDimColor()).GetColor() );
    2568             :                                     // translate sound bits to file url
    2569          39 :                                     if( pAnimation->HasSoundEffect() )
    2570           0 :                                         pAnimation->SetSoundFileUrl( ReadSound( pAnimation->GetSoundRef() ) );
    2571             : 
    2572          39 :                                     bool bDontAnimateInvisibleShape = false;
    2573             :                                     {
    2574          39 :                                         SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
    2575             : 
    2576          83 :                                         if( pTextObj && pTextObj->HasText() &&
    2577          22 :                                             !pObj->ISA( SdrObjGroup ) &&
    2578          22 :                                             pAnimation->HasAnimateAssociatedShape() )
    2579             :                                         {
    2580           6 :                                             const SfxItemSet& rObjItemSet = pObj->GetMergedItemSet();
    2581             : 
    2582           6 :                                             XFillStyle eFillStyle = ((XFillStyleItem&)(rObjItemSet.Get(XATTR_FILLSTYLE))).GetValue();
    2583           6 :                                             XLineStyle eLineStyle = ((XLineStyleItem&)(rObjItemSet.Get(XATTR_LINESTYLE))).GetValue();
    2584             : 
    2585           6 :                                             if ( ( eFillStyle == XFILL_NONE ) && ( eLineStyle == XLINE_NONE ) )
    2586           5 :                                                 bDontAnimateInvisibleShape = true;
    2587             :                                         }
    2588             :                                     }
    2589          39 :                                     if( bDontAnimateInvisibleShape )
    2590           5 :                                         pAnimation->SetAnimateAssociatedShape(false);
    2591             : 
    2592             :                                     //maybe some actions necessary to ensure that animations on master pages are played before animations on normal pages
    2593             :                                     ///mabe todo in future: bool bIsEffectOnMasterPage = !bInhabitanceChecked;?
    2594             : 
    2595          39 :                                     maAnimations[pObj] = pAnimation;
    2596             : 
    2597          39 :                                     bAnimationInfoFound = sal_True;
    2598          39 :                                 }
    2599             :                             }
    2600             :                         }
    2601          39 :                         break;
    2602             :                         case PPT_PST_InteractiveInfo:
    2603             :                         {
    2604           0 :                             sal_uInt32 nFilePosMerk2 = rSt.Tell();
    2605           0 :                             rtl::OUString aMacroName;
    2606             : 
    2607           0 :                             if(SeekToRec( rSt, PPT_PST_CString, nHdRecEnd, NULL, 0 ) )
    2608           0 :                                 ReadString(aMacroName);
    2609             : 
    2610           0 :                             rSt.Seek( nFilePosMerk2 );
    2611           0 :                             DffRecordHeader aHdInteractiveInfoAtom;
    2612           0 :                             if ( SeekToRec( rSt, PPT_PST_InteractiveInfoAtom, nHdRecEnd, &aHdInteractiveInfoAtom ) )
    2613             :                             {
    2614             :                                 PptInteractiveInfoAtom aInteractiveInfoAtom;
    2615           0 :                                 rSt >> aInteractiveInfoAtom;
    2616             : 
    2617             :                                 // interactive object
    2618           0 :                                 SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
    2619             : 
    2620           0 :                                 ( (ImplSdPPTImport*) this )->FillSdAnimationInfo( pInfo, &aInteractiveInfoAtom, aMacroName );
    2621           0 :                                 if ( aInteractiveInfoAtom.nAction == 6 ) // Sj -> media action
    2622             :                                 {
    2623           0 :                                     rHdClientData.SeekToContent( rStCtrl );
    2624           0 :                                     DffRecordHeader aObjRefAtomHd;
    2625           0 :                                     if ( SeekToRec( rSt, PPT_PST_ExObjRefAtom, nHdRecEnd, &aObjRefAtomHd ) )
    2626             :                                     {
    2627             :                                         sal_uInt32 nRef;
    2628           0 :                                         rSt >> nRef;
    2629           0 :                                         String aMediaURL( ReadMedia( nRef ) );
    2630           0 :                                         if ( !aMediaURL.Len() )
    2631           0 :                                             aMediaURL = ReadSound( nRef );
    2632           0 :                                         if ( aMediaURL.Len() )
    2633             :                                         {
    2634           0 :                                             SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() );
    2635           0 :                                             pMediaObj->SetModel( pObj->GetModel() );
    2636           0 :                                             pMediaObj->SetMergedItemSet( pObj->GetMergedItemSet() );
    2637             : 
    2638             :                                             //--remove object from maAnimations list and add the new object instead
    2639           0 :                                             Ppt97AnimationPtr pAnimation;
    2640             :                                             {
    2641           0 :                                                 tAnimationMap::iterator aFound = maAnimations.find( pObj );
    2642           0 :                                                 if( aFound != maAnimations.end() )
    2643             :                                                 {
    2644           0 :                                                     pAnimation = (*aFound).second;
    2645           0 :                                                     maAnimations.erase(aFound);
    2646             :                                                 }
    2647           0 :                                                 maAnimations[pMediaObj] = pAnimation;
    2648             :                                             }
    2649             :                                             //--
    2650             : 
    2651           0 :                                             SdrObject::Free( pObj ), pObj = pMediaObj;  // SJ: hoping that pObj is not inserted in any list
    2652           0 :                                             pMediaObj->setURL( aMediaURL );
    2653           0 :                                         }
    2654             :                                     }
    2655             :                                 }
    2656           0 :                             }
    2657             :                         }
    2658           0 :                         break;
    2659             :                     }
    2660         266 :                     aHd.SeekToEndOfRecord( rSt );
    2661             :                 }
    2662         532 :                 while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) );
    2663             : 
    2664         261 :                 if ( bInhabitanceChecked || bAnimationInfoFound )
    2665             :                     break;
    2666         139 :                 bInhabitanceChecked = sal_True;
    2667         139 :                 if ( ! ( IsProperty( DFF_Prop_hspMaster ) && SeekToShape( rSt, pData, GetPropertyValue( DFF_Prop_hspMaster ) ) ) )
    2668             :                     break;
    2669          83 :                 rSt >> aMasterShapeHd;
    2670          83 :                 if ( !SeekToRec( rSt, DFF_msofbtClientData, aMasterShapeHd.GetRecEndFilePos(), &aMasterShapeHd ) )
    2671             :                     break;
    2672          83 :                 aMasterShapeHd.SeekToContent( rSt );
    2673          83 :                 rHdClientData = aMasterShapeHd;
    2674             :             }
    2675             :         }
    2676             :     }
    2677        1240 :     return pObj;
    2678             : }
    2679             : 
    2680             : 
    2681             : bool
    2682           0 : ImplSdPPTImport::ReadFormControl( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const
    2683             : {
    2684           0 :     uno::Reference< frame::XModel > xModel;
    2685           0 :     if (  mpDoc->GetDocSh() )
    2686             :     {
    2687           0 :         xModel = mpDoc->GetDocSh()->GetModel();
    2688           0 :         oox::ole::MSConvertOCXControls mCtrlImporter( xModel );
    2689           0 :         return mCtrlImporter.ReadOCXStorage( rSrc1, rFormComp );
    2690             :     }
    2691           0 :     return false;
    2692             : }
    2693             : 
    2694             : // ---------------------
    2695             : // - exported function -
    2696             : // ---------------------
    2697             : 
    2698           6 : extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL ImportPPT(
    2699             :         SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium )
    2700             : {
    2701           6 :     sal_Bool bRet = sal_False;
    2702             : 
    2703           6 :     SdPPTImport* pImport = new SdPPTImport( pDocument, rDocStream, rStorage, rMedium );
    2704           6 :     bRet = pImport->Import();
    2705             : 
    2706           6 :     delete pImport;
    2707             : 
    2708           6 :     return bRet;
    2709           3 : }
    2710             : 
    2711             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10