merge the formfield patch from ooo-build
[ooovba.git] / sd / source / filter / ppt / pptin.cxx
blob79581f1578a7f15e21865533a3f3f5389f42ff32
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pptin.cxx,v $
10 * $Revision: 1.92.78.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <svx/numitem.hxx>
36 #include <unotools/ucbstreamhelper.hxx>
37 #include <vcl/wrkwin.hxx>
38 #include <svtools/urihelper.hxx>
39 #include <svx/svxids.hrc>
40 #include <svx/svdfppt.hxx>
41 #include <svx/svditer.hxx>
42 #include <sfx2/docfile.hxx>
43 #include <sfx2/app.hxx>
44 #include <svx/svdograf.hxx>
45 #include <svx/svdlayer.hxx>
46 #include <vcl/msgbox.hxx>
47 #include <svtools/style.hxx>
48 #include <svx/xflclit.hxx>
49 #include <svx/eeitem.hxx>
50 #include <svx/colritem.hxx>
51 #include <svtools/whiter.hxx>
52 #include <svx/xgrad.hxx>
53 #include <svx/xflgrit.hxx>
54 #include <svx/xbtmpit.hxx>
55 #include <svx/xlnclit.hxx>
56 #include <svx/adjitem.hxx>
57 #include <svx/editeng.hxx>
58 #include <svx/bulitem.hxx>
59 #include <svx/lrspitem.hxx>
60 #include <svx/lspcitem.hxx>
61 #include <svx/tstpitem.hxx>
63 #include <sfx2/docinf.hxx>
65 #include "glob.hrc"
66 #include "pptin.hxx"
67 #include "Outliner.hxx"
68 #include "drawdoc.hxx"
69 #include "sdpage.hxx"
70 #include "sdresid.hxx"
71 #include "pres.hxx"
72 #include "sdresid.hxx"
73 #include "stlpool.hxx"
74 #include "anminfo.hxx"
75 #include <svx/gallery.hxx>
76 #include <tools/urlobj.hxx>
77 #include <svx/numitem.hxx>
78 #include <svtools/itempool.hxx>
79 #include <svx/fhgtitem.hxx>
80 #include <svx/svdopage.hxx>
81 #include <svx/svdomedia.hxx>
82 #include <svx/svdogrp.hxx>
83 #include "propread.hxx"
84 #include <cusshow.hxx>
85 #include <vcl/bmpacc.hxx>
87 #include "../../ui/inc/DrawDocShell.hxx"
88 #include "../../ui/inc/FrameView.hxx"
89 #include "../../ui/inc/optsitem.hxx"
91 #include <svtools/fltrcfg.hxx>
92 #include <sfx2/progress.hxx>
93 #include <unotools/localfilehelper.hxx>
94 #include <svx/editstat.hxx>
95 #include <svtools/pathoptions.hxx>
96 #include <sfx2/docfac.hxx>
97 #define MAX_USER_MOVE 2
99 #include "pptinanimations.hxx"
100 #include "ppt97animations.hxx"
102 #include <com/sun/star/document/XDocumentProperties.hpp>
103 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
106 using namespace ::com::sun::star;
109 SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium, MSFilterTracer* pTracer )
112 sal_uInt32 nImportFlags = 0;
114 #ifdef DBG_UTIL
115 PropRead* pSummaryInformation = new PropRead( rStorage, String( RTL_CONSTASCII_USTRINGPARAM( "\005SummaryInformation" ) ) );
116 if ( pSummaryInformation->IsValid() )
118 pSummaryInformation->Read();
119 sal_uInt8 aPropSetGUID[ 16 ] =
121 0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9
123 Section* pSection = (Section*)pSummaryInformation->GetSection( aPropSetGUID );
124 if ( pSection )
126 PropItem aPropItem;
127 if ( pSection->GetProperty( PID_COMMENTS, aPropItem ) )
129 String aComment;
130 aPropItem.Read( aComment );
131 if ( aComment.Search( String( RTL_CONSTASCII_USTRINGPARAM( "Applixware" ) ), 0 ) != STRING_NOTFOUND )
133 nImportFlags |= PPT_IMPORTFLAGS_NO_TEXT_ASSERT;
138 delete pSummaryInformation;
139 #endif
141 PowerPointImportParam aParam( rDocStream, nImportFlags, pTracer );
142 SvStream* pCurrentUserStream = rStorage.OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) ), STREAM_STD_READ );
143 if( pCurrentUserStream )
145 *pCurrentUserStream >> aParam.aCurrentUserAtom;
146 delete pCurrentUserStream;
149 if( pDocument )
151 // iterate over all styles
152 SdStyleSheetPool* pStyleSheetPool = pDocument->GetSdStyleSheetPool();
154 sal_uInt32 nStyles = pStyleSheetPool ? pStyleSheetPool->GetStyles().size() : 0;
155 for (sal_uInt32 nStyle = 0; nStyle < nStyles; nStyle++)
157 SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pStyleSheetPool->GetStyles()[nStyle].get() );
158 SfxItemSet& rSet = pSheet->GetItemSet();
160 // if autokerning is set in style, override it, ppt has no autokerning
161 if( rSet.GetItemState( EE_CHAR_PAIRKERNING, FALSE ) == SFX_ITEM_SET )
162 rSet.ClearItem( EE_CHAR_PAIRKERNING );
166 pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
169 sal_Bool SdPPTImport::Import()
171 return pFilter->Import();
174 SdPPTImport::~SdPPTImport()
176 delete pFilter;
179 ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SvStorage& rStorage_, SfxMedium& rMedium, PowerPointImportParam& rParam )
180 : SdrPowerPointImport ( rParam, rMedium.GetBaseURL() )
181 , mrMed ( rMedium )
182 , mrStorage ( rStorage_ )
183 , mbDocumentFound ( FALSE )
184 , mnFilterOptions ( 0 )
186 mpDoc = pDocument;
187 if ( bOk )
189 mbDocumentFound = SeekToDocument( &maDocHd ); // maDocHd = the latest DocumentHeader
190 while ( SeekToRec( rStCtrl, PPT_PST_Document, nStreamLen, &maDocHd ) )
191 mbDocumentFound = TRUE;
193 UINT32 nDggContainerOfs = 0;
195 if ( mbDocumentFound )
197 ULONG nPosMerk = rStCtrl.Tell();
199 pStData = rStorage_.OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ), STREAM_STD_READ );
201 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
202 ULONG nDocLen = maDocHd.GetRecEndFilePos();
203 DffRecordHeader aPPDGHd;
204 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawingGroup, nDocLen, &aPPDGHd ) )
206 ULONG nPPDGLen = aPPDGHd.GetRecEndFilePos();
207 if ( SeekToRec( rStCtrl, DFF_msofbtDggContainer, nPPDGLen, NULL ) )
208 nDggContainerOfs = rStCtrl.Tell();
210 rStCtrl.Seek( nPosMerk );
212 sal_uInt32 nSvxMSDffOLEConvFlags2 = 0;
214 SvtFilterOptions* pBasOpt = SvtFilterOptions::Get();
215 if ( pBasOpt )
217 if ( pBasOpt->IsLoadPPointBasicCode() )
218 mnFilterOptions |= 1;
219 if ( pBasOpt->IsMathType2Math() )
220 nSvxMSDffOLEConvFlags2 |= OLE_MATHTYPE_2_STARMATH;
221 if ( pBasOpt->IsWinWord2Writer() )
222 nSvxMSDffOLEConvFlags2 |= OLE_WINWORD_2_STARWRITER;
223 if ( pBasOpt->IsExcel2Calc() )
224 nSvxMSDffOLEConvFlags2 |= OLE_EXCEL_2_STARCALC;
225 if ( pBasOpt->IsPowerPoint2Impress() )
226 nSvxMSDffOLEConvFlags2 |= OLE_POWERPOINT_2_STARIMPRESS;
229 InitSvxMSDffManager( nDggContainerOfs, pStData, nSvxMSDffOLEConvFlags2 );
230 SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS
231 | SVXMSDFF_SETTINGS_IMPORT_PPT );
232 SetModel( mpDoc, 576 );
236 //////////////////////////////////////////////////////////////////////////
238 // Dtor
240 //////////////////////////////////////////////////////////////////////////
242 ImplSdPPTImport::~ImplSdPPTImport()
244 for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
245 delete (String*)pPtr;
246 delete pStData;
249 //////////////////////////////////////////////////////////////////////////
251 // Import
253 //////////////////////////////////////////////////////////////////////////
255 sal_Bool ImplSdPPTImport::Import()
257 if ( !bOk )
258 return FALSE;
260 pSdrModel->setLock( sal_True );
261 SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
262 sal_uInt32 nControlWord = rOutl.GetEditEngine().GetControlWord();
263 nControlWord |= EE_CNTRL_ULSPACESUMMATION;
264 nControlWord &=~ EE_CNTRL_ULSPACEFIRSTPARA;
265 ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
267 SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
268 mnBackgroundLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), FALSE );
269 mnBackgroundObjectsLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), FALSE );
271 ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
272 if ( pDocShell )
273 SeekOle( pDocShell, mnFilterOptions );
275 // hyperlinks
276 PropRead* pDInfoSec2 = new PropRead( mrStorage, String( RTL_CONSTASCII_USTRINGPARAM( "\005DocumentSummaryInformation" ) ) );
277 if ( pDInfoSec2->IsValid() )
279 PropItem aPropItem;
281 UINT32 nType, nPropSize, nPropCount;
283 pDInfoSec2->Read();
285 BYTE aPropSetGUID[ 16 ] =
287 0x02, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
289 Section* pSection = (Section*)pDInfoSec2->GetSection( aPropSetGUID );
290 if ( pSection )
292 if ( pSection->GetProperty( PID_SLIDECOUNT, aPropItem ) )
294 aPropItem >> nType;
295 if ( ( nType == VT_I4 ) || ( nType == VT_UI4 ) )
297 // examine PID_HEADINGPAIR to get the correct entry for PID_DOCPARTS
298 UINT32 nSlideCount, nVecCount;
299 aPropItem >> nSlideCount;
300 if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
302 UINT32 nSlideTitleIndex = 0, nSlideTitleCount = 0;
303 UINT32 nFontIndex, nFontCount = 0;
304 UINT32 nDesignTemplateIndex, nDesignTemplateCount = 0;
305 UINT32 i, nTemp, nEntryCount = 0;
307 String aUString;
309 aPropItem >> nType
310 >> nVecCount;
312 if ( ( nType == ( VT_VARIANT | VT_VECTOR ) ) && ( nVecCount ^ 1 ) )
314 nVecCount >>= 1;
316 for ( i = 0; i < nVecCount; i++ )
318 if ( !aPropItem.Read( aUString, VT_EMPTY, FALSE ) )
319 break;
320 aPropItem >> nType;
321 if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
322 break;
323 aPropItem >> nTemp;
324 if ( aUString.EqualsAscii("Slide Titles") || aUString.EqualsAscii("Folientitel") )
326 nSlideTitleCount = nTemp;
327 nSlideTitleIndex = nEntryCount;
329 else if ( aUString.EqualsAscii("Fonts Used") )
331 nFontCount = nTemp;
332 nFontIndex = nEntryCount;
334 else if ( aUString.EqualsAscii("Design Template") )
336 nDesignTemplateCount = nTemp;
337 nDesignTemplateIndex = nEntryCount;
339 nEntryCount += nTemp;
342 if ( ( nSlideCount == nSlideTitleCount ) && pSection->GetProperty( PID_DOCPARTS, aPropItem ) )
344 aPropItem >> nType
345 >> nVecCount;
347 if ( ( nVecCount >= ( nSlideTitleIndex + nSlideTitleCount ) )
348 && ( nType == ( VT_LPSTR | VT_VECTOR ) ) )
350 for ( i = 0; i != nSlideTitleIndex; i++ )
352 aPropItem >> nTemp;
353 aPropItem.SeekRel( nTemp );
355 for ( i = 0; i < nSlideTitleCount; i++ )
357 if ( !aPropItem.Read( aUString, nType, FALSE ) )
358 break;
359 String* pString = new String( aUString );
360 if ( pString->EqualsAscii( "No Slide Title" ))
361 *pString = String();
362 else
364 void* pPtr;
365 for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
367 if ( *((String*)pPtr ) == *pString )
369 *pString = String();
370 break;
374 maSlideNameList.Insert( pString, LIST_APPEND );
382 BYTE aUserPropSetGUID[ 16 ] =
384 0x05, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
386 pSection = (Section*)pDInfoSec2->GetSection( aUserPropSetGUID );
387 if ( pSection )
389 Dictionary aDict;
390 if ( pSection->GetDictionary( aDict ) )
392 UINT32 nPropId = aDict.GetProperty( rtl::OUString::createFromAscii("_PID_HLINKS" ));
393 if ( nPropId )
395 if ( pSection->GetProperty( nPropId, aPropItem ) )
397 aPropItem.Seek( STREAM_SEEK_TO_BEGIN );
398 aPropItem >> nType;
399 if ( nType == VT_BLOB )
401 aPropItem >> nPropSize
402 >> nPropCount;
404 if ( ! ( nPropCount % 6 ) )
406 UINT32 i;
408 nPropCount /= 6; // 6 propertys a hyperlink
410 SdHyperlinkEntry* pHyperlink = 0;
411 for ( i = 0; i < nPropCount; i++ )
413 pHyperlink = new SdHyperlinkEntry;
414 pHyperlink->nIndex = 0;
415 aPropItem >> nType;
416 if ( nType != VT_I4 )
417 break;
418 aPropItem >> pHyperlink->nPrivate1
419 >> nType;
420 if ( nType != VT_I4 )
421 break;
422 aPropItem >> pHyperlink->nPrivate2
423 >> nType;
424 if ( nType != VT_I4 )
425 break;
426 aPropItem >> pHyperlink->nPrivate3
427 >> nType;
428 if ( nType != VT_I4 )
429 break;
430 aPropItem >> pHyperlink->nInfo;
431 if ( !aPropItem.Read( pHyperlink->aTarget, VT_EMPTY ) )
432 break;
434 // #n382718# (and #n261623#) Convert '\\' notation to 'smb://'
435 INetURLObject aUrl( pHyperlink->aTarget, INET_PROT_FILE );
436 pHyperlink->aTarget = aUrl.GetMainURL( INetURLObject::NO_DECODE );
438 if ( !aPropItem.Read( pHyperlink->aSubAdress, VT_EMPTY ) )
439 break;
440 pHyperlink->nStartPos = pHyperlink->nEndPos = -1;
442 if ( pHyperlink->aSubAdress.Len() ) // get the converted subadress
444 sal_uInt32 nPageNumber = 0;
445 String aString( pHyperlink->aSubAdress );
446 ByteString aStringAry[ 3 ];
447 sal_uInt16 nTokenCount = aString.GetTokenCount( ',' );
448 if ( nTokenCount > 3 )
449 nTokenCount = 3;
450 sal_uInt16 nToken;
451 for( nToken = 0; nToken < nTokenCount; nToken++ )
452 aStringAry[ nToken ] = ByteString( aString.GetToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8 );
454 sal_Bool bSucceeded = sal_False;
456 // first pass, searching for a SlideId
457 for( nToken = 0; nToken < nTokenCount; nToken++ )
459 if ( aStringAry[ nToken ].IsNumericAscii() )
461 sal_Int32 nNumber = aStringAry[ nToken ].ToInt32();
462 if ( nNumber & ~0xff )
464 PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
465 if ( pPageList )
467 sal_uInt16 nPage = pPageList->FindPage( nNumber );
468 if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
470 nPageNumber = nPage;
471 bSucceeded = sal_True;
472 break;
478 if ( !bSucceeded )
479 { // second pass, searching for a SlideName
480 for ( nToken = 0; nToken < nTokenCount; nToken++ )
482 String aToken( aString.GetToken( nToken, (sal_Unicode)',' ) );
483 for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
485 if ( *(String*)pPtr == aToken )
487 nPageNumber = maSlideNameList.GetCurPos();
488 bSucceeded = sal_True;
489 break;
494 if ( !bSucceeded )
495 { // third pass, searching for a slide number
496 for ( nToken = 0; nToken < nTokenCount; nToken++ )
498 if ( aStringAry[ nToken ].IsNumericAscii() )
500 sal_Int32 nNumber = aStringAry[ nToken ].ToInt32();
501 if ( ( nNumber & ~0xff ) == 0 )
503 nPageNumber = (sal_uInt32)nNumber - 1;
504 bSucceeded = sal_True;
505 break;
510 if ( bSucceeded )
512 if ( nPageNumber < maSlideNameList.Count() )
513 pHyperlink->aConvSubString = *(String*)maSlideNameList.GetObject( nPageNumber );
514 if ( !pHyperlink->aConvSubString.Len() )
516 pHyperlink->aConvSubString = String( SdResId( STR_PAGE ) );
517 pHyperlink->aConvSubString.Append( sal_Unicode( ' ' ) );
518 pHyperlink->aConvSubString.Append( mpDoc->CreatePageNumValue( (USHORT)nPageNumber + 1 ) );
522 aHyperList.Insert( pHyperlink, LIST_APPEND );
524 if ( i != nPropCount )
525 delete pHyperlink;
534 delete pDInfoSec2;
536 if ( mbDocumentFound )
538 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
539 // HyperList lesen / Indexe der einzelnen Eintraege setzen
540 DffRecordHeader aHyperHd;
541 if ( SeekToRec( rStCtrl, PPT_PST_ExObjList, maDocHd.GetRecEndFilePos(), &aHyperHd ) )
543 UINT32 nExObjHyperListLen = aHyperHd.GetRecEndFilePos();
544 for ( void* pPtr = aHyperList.First(); pPtr; pPtr = aHyperList.Next() )
546 DffRecordHeader aHyperE;
547 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlink, nExObjHyperListLen, &aHyperE ) )
548 break;
549 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlinkAtom, nExObjHyperListLen, NULL, 0 ) )
550 break;
551 rStCtrl.SeekRel( 8 );
552 rStCtrl >> ((SdHyperlinkEntry*)pPtr)->nIndex;
553 aHyperE.SeekToEndOfRecord( rStCtrl );
558 Size aVisAreaSize;
559 switch ( aUserEditAtom.eLastViewType )
561 case 5 : // notes master
562 case 3 : // notes
563 aVisAreaSize = aDocAtom.GetNotesPageSize();
564 break;
565 default :
566 aVisAreaSize = aDocAtom.GetSlidesPageSize();
568 Scale( aVisAreaSize );
569 pDocShell->SetVisArea( Rectangle( Point(), aVisAreaSize ) );
571 ///////////////////////////////////////////////////////////
572 // create master pages:
573 ///////////////////////////////////////////////////////////
574 SfxProgress* pStbMgr = new SfxProgress( pDocShell, String( SdResId( STR_POWERPOINT_IMPORT ) ),
575 pMasterPages->Count() + pSlidePages->Count() + pNotePages->Count() );
577 UINT32 nImportedPages = 0;
579 UINT16 nMasterAnz = GetPageCount( PPT_MASTERPAGE );
581 for ( USHORT nMasterNum = 0; nMasterNum < nMasterAnz; nMasterNum++ )
583 SetPageNum( nMasterNum, PPT_MASTERPAGE );
584 SdPage* pPage = (SdPage*)MakeBlancPage( TRUE );
585 if ( pPage )
587 BOOL bNotesMaster = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bNotesMaster;
588 BOOL bStarDrawFiller = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bStarDrawFiller;
590 PageKind ePgKind = ( bNotesMaster ) ? PK_NOTES : PK_STANDARD;
591 pPage->SetPageKind( ePgKind );
592 pSdrModel->InsertMasterPage( (SdrPage*)pPage );
593 if ( bNotesMaster && bStarDrawFiller )
594 ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_NOTES, TRUE );
595 if ( nMasterNum )
597 boost::optional< sal_Int16 > oStartNumbering;
598 SfxStyleSheet* pSheet;
599 if ( nMasterNum == 1 )
601 ///////////////////
602 // standardsheet //
603 ///////////////////
604 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
605 if ( pSheet )
607 SfxItemSet& rItemSet = pSheet->GetItemSet();
608 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
609 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
610 aParagraph.AppendPortion( aPortion );
611 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
612 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
616 // PSEUDO
617 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
618 if ( pSheet )
620 SfxItemSet& rItemSet = pSheet->GetItemSet();
621 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
622 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
623 aParagraph.AppendPortion( aPortion );
624 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
625 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
628 ///////////////////////////////////////////////////////////
629 // create layoutstylesheets, set layoutname and stylesheet
630 // (nur auf Standard- und Notizseiten)
631 ///////////////////////////////////////////////////////////
632 String aLayoutName( SdResId( STR_LAYOUT_DEFAULT_NAME ) );
633 if ( nMasterNum > 2 )
635 if ( ePgKind == PK_STANDARD )
636 { // Standardseite: Neues Praesentationslayout erzeugen
637 aLayoutName = String( SdResId( STR_LAYOUT_DEFAULT_TITLE_NAME ) );
638 aLayoutName += String::CreateFromInt32( (sal_Int32)( ( nMasterNum + 1 ) / 2 - 1 ) );
639 ( (SdStyleSheetPool*)mpDoc->GetStyleSheetPool() )->CreateLayoutStyleSheets( aLayoutName );
641 else // Notizseite: Praesentationslayout von der Standardseite verwenden
642 aLayoutName = ( (SdPage*)mpDoc->GetMasterPage( nMasterNum - 1 ) )->GetName();
644 pPage->SetName( aLayoutName );
645 aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
646 aLayoutName += String( SdResId( STR_LAYOUT_OUTLINE ) );
647 pPage->SetLayoutName( aLayoutName );
649 /////////////////////
650 // set stylesheets //
651 /////////////////////
652 if ( pPage->GetPageKind() == PK_STANDARD )
654 UINT32 nTitleInstance = TSS_TYPE_PAGETITLE;
655 UINT32 nOutlinerInstance = TSS_TYPE_BODY;
656 // BOOL bSwapStyleSheet = pSlideLayout->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE;
657 // if ( bSwapStyleSheet )
658 // {
659 // nTitleInstance = TSS_TYPE_TITLE;
660 // nOutlinerInstance = TSS_TYPE_SUBTITLE;
661 // }
662 /////////////////////
663 // titelstylesheet //
664 /////////////////////
665 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
666 if ( pSheet )
668 SfxItemSet& rItemSet = pSheet->GetItemSet();
669 PPTParagraphObj aParagraph( *pPPTStyleSheet, nTitleInstance, 0 );
670 PPTPortionObj aPortion( *pPPTStyleSheet, nTitleInstance, 0 );
671 aParagraph.AppendPortion( aPortion );
672 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
673 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
675 ////////////////////////
676 // outlinerstylesheet //
677 ////////////////////////
678 UINT16 nLevel;
679 PPTParagraphObj* pParagraphs[ 9 ];
680 PPTParagraphObj* pPreviousPara = NULL;
682 for ( nLevel = 0; nLevel < 9; nLevel++ )
684 String aName( pPage->GetLayoutName() );
685 aName.Append( (sal_Unicode)( ' ' ) );
686 aName.Append( String::CreateFromInt32( nLevel + 1 ) );
687 SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
688 DBG_ASSERT( pOutlineSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden" );
689 if ( pOutlineSheet )
691 pParagraphs[ nLevel ] = new PPTParagraphObj( *pPPTStyleSheet, nOutlinerInstance, nLevel );
692 SfxItemSet& rItemSet = pOutlineSheet->GetItemSet();
693 PPTPortionObj aPortion( *pPPTStyleSheet, nOutlinerInstance, nLevel );
694 pParagraphs[ nLevel ]->AppendPortion( aPortion );
695 pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, pPreviousPara );
696 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
697 pPreviousPara = pParagraphs[ nLevel ];
699 else
700 pParagraphs[ nLevel ] = NULL;
702 for ( nLevel = 0; nLevel < 9; delete pParagraphs[ nLevel++ ] ) ;
703 /////////////////////////
704 // subtitle stylesheet //
705 /////////////////////////
706 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
707 if ( pSheet )
709 SfxItemSet& rItemSet = pSheet->GetItemSet();
710 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
711 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
712 aParagraph.AppendPortion( aPortion );
713 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
714 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
717 else if ( ePgKind == PK_NOTES )
719 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
720 if ( pSheet )
722 SfxItemSet& rItemSet = pSheet->GetItemSet();
723 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
724 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
725 aParagraph.AppendPortion( aPortion );
726 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
727 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
734 SdPage* pMPage;
735 sal_uInt16 i;
736 for ( i = 1; i < mpDoc->GetMasterPageCount() && ( (pMPage = (SdPage*)mpDoc->GetMasterPage( i )) != 0 ); i++ )
738 SetPageNum( i, PPT_MASTERPAGE );
739 /////////////////////////////////////////////
740 // importing master page objects //
741 /////////////////////////////////////////////
742 PptSlidePersistList* pList = GetPageList( eAktPageKind );
743 PptSlidePersistEntry* pPersist = ( pList && ( nAktPageNum < pList->Count() ) )
744 ? (*pList)[ nAktPageNum ] : NULL;
745 if ( pPersist )
747 if ( pPersist->bStarDrawFiller && pPersist->bNotesMaster && ( nAktPageNum > 2 ) && ( ( nAktPageNum & 1 ) == 0 ) )
749 pSdrModel->DeleteMasterPage( nAktPageNum );
750 SdrPage* pNotesClone = ((SdPage*)pSdrModel->GetMasterPage( 2 ))->Clone();
751 pSdrModel->InsertMasterPage( pNotesClone, nAktPageNum );
752 if ( pNotesClone )
754 String aLayoutName( ((SdPage*)pSdrModel->GetMasterPage( nAktPageNum - 1 ))->GetLayoutName() );
755 ((SdPage*)pNotesClone)->SetPresentationLayout( aLayoutName, sal_False, sal_False, sal_False );
756 ((SdPage*)pNotesClone)->SetLayoutName( aLayoutName );
759 else if ( ( pPersist->bStarDrawFiller == FALSE ) )
761 PptSlidePersistEntry* pE = pPersist;
762 while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
764 sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
765 if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
766 break;
767 else
768 pE = (*pList)[ nNextMaster ];
770 SdrObject* pObj = ImportPageBackgroundObject( *pMPage, pE->nBackgroundOffset, TRUE ); // import background
771 if ( pObj )
772 pMPage->NbcInsertObject( pObj );
774 sal_Bool bNewAnimationsUsed = sal_False;
775 ProcessData aProcessData( *(*pList)[ nAktPageNum ], (SdPage*)pMPage );
776 sal_uInt32 nFPosMerk = rStCtrl.Tell();
777 DffRecordHeader aPageHd;
778 if ( SeekToAktPage( &aPageHd ) )
780 if ( mbTracing )
781 mpTracer->AddAttribute( rtl::OUString::createFromAscii( "MasterPage" ), rtl::OUString::valueOf( (sal_Int32) (nAktPageNum + 1) ) );
783 while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
785 DffRecordHeader aHd;
786 rStCtrl >> aHd;
787 switch( aHd.nRecType )
789 case PPT_PST_PPDrawing :
791 aHd.SeekToBegOfRecord( rStCtrl );
792 DffRecordHeader aPPDrawHd;
793 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
795 sal_uInt32 nPPDrawEnd = aPPDrawHd.GetRecEndFilePos();
796 DffRecordHeader aEscherF002Hd;
797 if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, nPPDrawEnd, &aEscherF002Hd ) )
799 sal_uInt32 nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
800 DffRecordHeader aEscherObjListHd;
801 if ( SeekToRec( rStCtrl, DFF_msofbtSpgrContainer, nEscherF002End, &aEscherObjListHd ) )
803 sal_uInt32 nObjCount = 0;
804 while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aEscherObjListHd.GetRecEndFilePos() ) )
806 DffRecordHeader aHd2;
807 rStCtrl >> aHd2;
808 if ( ( aHd2.nRecType == DFF_msofbtSpContainer ) || ( aHd2.nRecType == DFF_msofbtSpgrContainer ) )
810 if ( nObjCount++ ) // skipping the first object
812 Rectangle aEmpty;
813 aHd2.SeekToBegOfRecord( rStCtrl );
814 SdrObject* pImpObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
815 if ( pImpObj )
817 pImpObj->SetLayer( mnBackgroundObjectsLayerID );
818 pMPage->NbcInsertObject( pImpObj );
822 aHd2.SeekToEndOfRecord( rStCtrl );
828 break;
830 case PPT_PST_ProgTags :
832 DffRecordHeader aProgTagHd;
833 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
835 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
837 DffRecordHeader aProgTagContentHd;
838 rStCtrl >> aProgTagContentHd;
839 switch( aProgTagContentHd.nRecType )
841 case DFF_msofbtAnimGroup :
843 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pMPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
844 ppt::AnimationImporter aImporter( this, rStCtrl );
845 aImporter.import( xPage, aProgTagContentHd );
846 bNewAnimationsUsed = sal_True;
848 break;
850 aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
854 break;
856 aHd.SeekToEndOfRecord( rStCtrl );
858 if ( mbTracing )
859 mpTracer->RemoveAttribute( rtl::OUString::createFromAscii( "MasterPage" ) );
861 rStCtrl.Seek( nFPosMerk );
862 ImportPageEffect( (SdPage*)pMPage, bNewAnimationsUsed );
864 ///////////////////////
865 // background object //
866 ///////////////////////
867 pObj = pMPage->GetObj( 0 );
868 if ( pObj && pObj->GetObjIdentifier() == OBJ_RECT )
870 if ( pMPage->GetPageKind() == PK_STANDARD )
872 // Hintergrundobjekt gefunden (erstes Objekt der MasterPage)
873 pObj->SetEmptyPresObj( TRUE );
874 pObj->SetUserCall( pMPage );
875 pObj->SetLayer( mnBackgroundLayerID );
877 // Schatten am ersten Objekt (Hintergrundobjekt) entfernen (#57918#)
878 SfxItemSet aTempAttr( mpDoc->GetPool() );
879 aTempAttr.Put( pObj->GetMergedItemSet() );
881 BOOL bShadowIsOn = ( (SdrShadowItem&)( aTempAttr.Get( SDRATTR_SHADOW ) ) ).GetValue();
882 if( bShadowIsOn )
884 aTempAttr.Put( SdrShadowItem( FALSE ) );
885 pObj->SetMergedItemSet( aTempAttr );
887 SfxStyleSheet* pSheet = pMPage->GetStyleSheetForPresObj( PRESOBJ_BACKGROUND );
888 if ( pSheet )
889 { // StyleSheet fuellen und dem Objekt zuweisen
890 pSheet->GetItemSet().ClearItem();
891 pSheet->GetItemSet().Put( pObj->GetMergedItemSet() );
892 aTempAttr.ClearItem();
893 pObj->SetMergedItemSet( aTempAttr );
894 pObj->SetStyleSheet( pSheet, FALSE );
896 pMPage->InsertPresObj( pObj, PRESOBJ_BACKGROUND );
898 // #110094#-15
899 // tell the page that it's visualization has changed
900 pMPage->ActionChanged();
905 if( pStbMgr )
906 pStbMgr->SetState( nImportedPages++ );
908 ////////////////////////////////////
909 // importing slide pages //
910 ////////////////////////////////////
912 UINT32 nFPosMerk = rStCtrl.Tell();
913 PptPageKind ePageKind = eAktPageKind;
914 UINT16 nPageNum = nAktPageNum;
916 SdPage* pHandoutPage = (SdPage*)MakeBlancPage( FALSE );
917 pHandoutPage->SetPageKind( PK_HANDOUT );
918 pSdrModel->InsertPage( pHandoutPage );
920 USHORT nPageAnz = GetPageCount( PPT_SLIDEPAGE );
921 if ( nPageAnz )
923 for ( USHORT nPage = 0; nPage < nPageAnz; nPage++ )
925 sal_Bool bNewAnimationsUsed = sal_False;
927 mePresChange = PRESCHANGE_SEMIAUTO;
928 SetPageNum( nPage, PPT_SLIDEPAGE );
929 SdPage* pPage = (SdPage*)MakeBlancPage( FALSE );
930 PptSlidePersistEntry* pMasterPersist = NULL;
931 if ( HasMasterPage( nPage, PPT_SLIDEPAGE ) ) // try to get the LayoutName from the masterpage
933 sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
934 pPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nMasterNum));
935 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
936 if ( pPageList && nMasterNum < pPageList->Count() )
937 pMasterPersist = (*pPageList)[ nMasterNum ];
938 pPage->SetLayoutName(((SdPage&)pPage->TRG_GetMasterPage()).GetLayoutName());
940 pPage->SetPageKind( PK_STANDARD );
941 pSdrModel->InsertPage( pPage ); // SJ: #i29625# because of form controls, the
942 ImportPage( pPage, pMasterPersist ); // page must be inserted before importing
943 SetHeaderFooterPageSettings( pPage, pMasterPersist );
944 // CWS preseng01: pPage->SetPageKind( PK_STANDARD );
946 DffRecordHeader aPageHd;
947 if ( SeekToAktPage( &aPageHd ) )
949 aPageHd.SeekToContent( rStCtrl );
950 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
952 DffRecordHeader aHd;
953 rStCtrl >> aHd;
954 switch ( aHd.nRecType )
956 case PPT_PST_ProgTags :
958 DffRecordHeader aProgTagHd;
959 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
961 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
963 DffRecordHeader aProgTagContentHd;
964 rStCtrl >> aProgTagContentHd;
965 switch( aProgTagContentHd.nRecType )
968 case PPT_PST_CommentContainer :
972 break;
974 case DFF_msofbtAnimGroup :
976 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
977 ppt::AnimationImporter aImporter( this, rStCtrl );
978 aImporter.import( xPage, aProgTagContentHd );
979 bNewAnimationsUsed = sal_True;
981 break;
983 case PPT_PST_NewlyAddedAtomByXP11008 : // ???
984 break;
986 case PPT_PST_NewlyAddedAtomByXP12011 : // ??? don't know, this atom is always 8 bytes big
987 break; // and is appearing in nearly every l10 progtag
989 aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
993 break;
995 case PPT_PST_HeadersFooters :
996 case PPT_PST_PPDrawing :
997 default:
998 break;
1001 aHd.SeekToEndOfRecord( rStCtrl );
1003 ImportPageEffect( (SdPage*)pPage, bNewAnimationsUsed );
1006 // creating the corresponding note page
1007 eAktPageKind = PPT_NOTEPAGE;
1008 SdPage* pNotesPage = (SdPage*)MakeBlancPage( FALSE );
1009 sal_uInt16 nNotesMasterNum = GetMasterPageIndex( nPage, PPT_SLIDEPAGE ) + 1;
1010 sal_uInt32 nNotesPageId = GetNotesPageId( nPage );
1011 if ( nNotesPageId )
1013 nImportedPages++;
1014 sal_uInt16 nNotesPageIndex = pNotePages->FindPage( nNotesPageId );
1015 if ( nNotesPageIndex == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
1016 nNotesPageIndex = 0;
1017 SetPageNum( nNotesPageIndex, PPT_NOTEPAGE );
1018 PptSlidePersistEntry* pMasterPersist2 = NULL;
1019 if ( HasMasterPage( nNotesPageIndex, PPT_NOTEPAGE ) ) // try to get the LayoutName from the masterpage
1021 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1022 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
1023 if ( pPageList && nNotesMasterNum < pPageList->Count() )
1024 pMasterPersist2 = (*pPageList)[ nNotesMasterNum ];
1025 pNotesPage->SetLayoutName( ((SdPage&)pNotesPage->TRG_GetMasterPage()).GetLayoutName() );
1027 pNotesPage->SetPageKind( PK_NOTES );
1028 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1029 pSdrModel->InsertPage( pNotesPage ); // SJ: #i29625# because of form controls, the
1030 ImportPage( pNotesPage, pMasterPersist2 ); // page must be inserted before importing
1031 SetHeaderFooterPageSettings( pNotesPage, pMasterPersist2 );
1032 pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, FALSE );
1034 else
1036 pNotesPage->SetPageKind( PK_NOTES );
1037 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1038 pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, TRUE );
1039 pSdrModel->InsertPage( pNotesPage );
1040 SdrObject* pPageObj = pNotesPage->GetPresObj( PRESOBJ_PAGE, 1 );
1041 if ( pPageObj )
1042 ((SdrPageObj*)pPageObj)->SetReferencedPage(pSdrModel->GetPage(( nPage << 1 ) + 1));
1045 if( pStbMgr )
1046 pStbMgr->SetState( nImportedPages++ );
1048 //////////////
1050 else
1052 // Das kann bei Dokumentvorlagen vorkommen
1053 eAktPageKind = PPT_SLIDEPAGE;
1054 SdrPage* pPage = MakeBlancPage( FALSE );
1055 pSdrModel->InsertPage( pPage );
1057 // #i37397#, trying to set the title master for the first page
1058 sal_uInt16 nMaster, nMasterCount = pSdrModel->GetMasterPageCount();
1059 SdPage* pFoundMaster = NULL;
1060 for ( nMaster = 1; nMaster < nMasterCount; nMaster++ )
1062 SdPage* pMaster = static_cast<SdPage*>( pSdrModel->GetMasterPage( nMaster ) );
1063 if ( pMaster->GetPageKind() == PK_STANDARD )
1065 SetPageNum( nMaster, PPT_MASTERPAGE );
1066 if ( !pFoundMaster )
1067 pFoundMaster = pMaster;
1068 else if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
1069 pFoundMaster = pMaster;
1070 if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
1071 break;
1074 if ( pFoundMaster )
1076 ((SdPage*)pPage)->TRG_SetMasterPage( *((SdPage*)pFoundMaster) );
1077 ((SdPage*)pPage)->SetLayoutName( ((SdPage*)pFoundMaster)->GetLayoutName() );
1079 ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_TITLE, TRUE, TRUE );
1081 eAktPageKind = PPT_NOTEPAGE;
1082 SdrPage* pNPage = MakeBlancPage( FALSE );
1083 pSdrModel->InsertPage( pNPage );
1085 SetPageNum( nPageNum, ePageKind );
1086 rStCtrl.Seek( nFPosMerk );
1088 ///////////////////////////////////////////////////////////////////
1089 // Handzettel und Notiz-Seiten erzeugen //
1090 ///////////////////////////////////////////////////////////////////
1091 bOk = mpDoc->CreateMissingNotesAndHandoutPages();
1092 if ( bOk )
1094 for ( i = 0; i < mpDoc->GetSdPageCount( PK_STANDARD ); i++ )
1096 ////////////////////
1097 // set AutoLayout //
1098 ////////////////////
1099 SetPageNum( i, PPT_SLIDEPAGE );
1100 SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
1101 AutoLayout eAutoLayout = AUTOLAYOUT_NONE;
1102 const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
1103 if ( pSlideLayout )
1105 switch ( pSlideLayout->eLayout ) // Praesentationslayouts fuer Standard-Seiten
1107 case PPT_LAYOUT_TITLEANDBODYSLIDE :
1109 eAutoLayout = AUTOLAYOUT_ENUM;
1110 USHORT nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1111 switch ( nID1 )
1113 case PPT_PLACEHOLDER_BODY :
1114 eAutoLayout = AUTOLAYOUT_ENUM;
1115 break;
1116 case PPT_PLACEHOLDER_TABLE :
1117 eAutoLayout = AUTOLAYOUT_TAB;
1118 break;
1119 case PPT_PLACEHOLDER_ORGANISZATIONCHART :
1120 eAutoLayout = AUTOLAYOUT_ORG;
1121 break;
1122 case PPT_PLACEHOLDER_GRAPH :
1123 eAutoLayout = AUTOLAYOUT_CHART;
1124 break;
1125 case PPT_PLACEHOLDER_OBJECT :
1126 eAutoLayout = AUTOLAYOUT_OBJ;
1127 break;
1128 case PPT_PLACEHOLDER_VERTICALTEXTBODY :
1129 eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE;
1130 break;
1133 break;
1135 case PPT_LAYOUT_2COLUMNSANDTITLE :
1137 eAutoLayout = AUTOLAYOUT_2TEXT;
1138 USHORT nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1139 USHORT nID2 = pSlideLayout->aPlaceholderId[ 2 ];
1140 if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_GRAPH )
1141 eAutoLayout = AUTOLAYOUT_TEXTCHART;
1142 else if ( nID1 == PPT_PLACEHOLDER_GRAPH && nID2 == PPT_PLACEHOLDER_BODY )
1143 eAutoLayout = AUTOLAYOUT_CHARTTEXT;
1144 else if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_CLIPART )
1145 eAutoLayout = AUTOLAYOUT_TEXTCLIP;
1146 else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_BODY )
1147 eAutoLayout = AUTOLAYOUT_CLIPTEXT;
1148 else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_VERTICALTEXTBODY )
1149 eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART;
1150 else if ( ( nID1 == PPT_PLACEHOLDER_BODY )
1151 && ( ( nID2 == PPT_PLACEHOLDER_OBJECT ) || ( nID2 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
1152 eAutoLayout = AUTOLAYOUT_TEXTOBJ;
1153 else if ( ( nID2 == PPT_PLACEHOLDER_BODY )
1154 && ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) || ( nID1 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
1155 eAutoLayout = AUTOLAYOUT_OBJTEXT;
1156 else if ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) && ( nID2 == PPT_PLACEHOLDER_OBJECT ) )
1157 eAutoLayout = AUTOLAYOUT_OBJ;
1159 break;
1161 case PPT_LAYOUT_2ROWSANDTITLE :
1163 eAutoLayout = AUTOLAYOUT_2TEXT;
1164 USHORT nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1165 USHORT nID2 = pSlideLayout->aPlaceholderId[ 2 ];
1166 if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_OBJECT )
1167 eAutoLayout = AUTOLAYOUT_TEXTOVEROBJ;
1168 else if ( nID1 == PPT_PLACEHOLDER_OBJECT && nID2 == PPT_PLACEHOLDER_BODY )
1169 eAutoLayout = AUTOLAYOUT_OBJOVERTEXT;
1171 break;
1173 case PPT_LAYOUT_TITLESLIDE :
1174 eAutoLayout = AUTOLAYOUT_TITLE;
1175 break;
1176 case PPT_LAYOUT_ONLYTITLE :
1177 eAutoLayout = AUTOLAYOUT_ONLY_TITLE;
1178 break;
1179 case PPT_LAYOUT_RIGHTCOLUMN2ROWS :
1180 eAutoLayout = AUTOLAYOUT_TEXT2OBJ;
1181 break;
1182 case PPT_LAYOUT_LEFTCOLUMN2ROWS :
1183 eAutoLayout = AUTOLAYOUT_2OBJTEXT;
1184 break;
1185 case PPT_LAYOUT_TOPROW2COLUMN :
1186 eAutoLayout = AUTOLAYOUT_2OBJOVERTEXT;
1187 break;
1188 case PPT_LAYOUT_4OBJECTS :
1189 eAutoLayout = AUTOLAYOUT_4OBJ;
1190 break;
1191 case PPT_LAYOUT_BIGOBJECT :
1192 eAutoLayout = AUTOLAYOUT_OBJ;
1193 break;
1194 case PPT_LAYOUT_TITLERIGHTBODYLEFT :
1195 eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE; // AUTOLAYOUT_ENUM;
1196 break;
1197 case PPT_LAYOUT_TITLERIGHT2BODIESLEFT :
1198 eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART; // AUTOLAYOUT_TEXT2OBJ;
1199 break;
1201 case PPT_LAYOUT_BOTTOMROW2COLUMNS :
1202 case PPT_LAYOUT_BLANCSLIDE :
1203 case PPT_LAYOUT_MASTERSLIDE : // Layout der Standard- und Titel-MasterPage
1204 case PPT_LAYOUT_TITLEMASTERSLIDE :
1205 case PPT_LAYOUT_MASTERNOTES : // Layout der Notizen-MasterPage
1206 case PPT_LAYOUT_NOTESTITLEBODY : // Praesentationslayout fuer Notiz-Seiten
1207 case PPT_LAYOUT_HANDOUTLAYOUT : // Praesentationslayout fuer Handzettelseiten
1208 eAutoLayout = AUTOLAYOUT_NONE;
1209 break;
1211 if ( eAutoLayout != AUTOLAYOUT_NONE )
1212 pPage->SetAutoLayout( eAutoLayout, FALSE );
1215 //////////////////////////////////////////////////////////////
1216 // Handzettel-MasterPage: Autolayout setzen //
1217 //////////////////////////////////////////////////////////////
1218 SdPage* pHandoutMPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
1219 pHandoutMPage->SetAutoLayout( AUTOLAYOUT_HANDOUT6, TRUE, TRUE );
1222 UINT32 nSlideCount = GetPageCount();
1223 for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.Count() ); i++ )
1225 SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
1226 String* pName = (String*)maSlideNameList.GetObject( i );
1227 if ( pPage && pName )
1229 if ( pName->Len() )
1230 pPage->SetName( *pName );
1231 else
1232 *pName = pPage->GetName();
1235 if ( mbDocumentFound )
1237 mpDoc->SetSummationOfParagraphs( sal_True );
1238 if ( pDocShell )
1240 ::sd::FrameView* pFrameView = mpDoc->GetFrameView( 0 );
1241 if ( !pFrameView )
1243 List* pFrameViewList = mpDoc->GetFrameViewList();
1244 if ( pFrameViewList )
1246 pFrameView = new ::sd::FrameView( mpDoc );
1247 if ( pFrameView )
1248 pFrameViewList->Insert( pFrameView );
1251 if ( pFrameView )
1253 sal_uInt16 nSelectedPage = 0;
1254 PageKind ePageKind = PK_STANDARD;
1255 EditMode eEditMode = EM_PAGE;
1257 switch ( aUserEditAtom.eLastViewType )
1259 case 7 : // outliner view
1261 SfxItemSet* pSet = mrMed.GetItemSet();
1262 if ( pSet )
1263 pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
1265 break;
1266 case 8 : // slide sorter
1268 SfxItemSet* pSet = mrMed.GetItemSet();
1269 if ( pSet )
1270 pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
1272 break;
1273 case 10 : // titlemaster
1274 nSelectedPage = 1;
1275 case 2 : // master
1277 ePageKind = PK_STANDARD;
1278 eEditMode = EM_MASTERPAGE;
1280 break;
1281 case 5 : // notes master
1282 eEditMode = EM_MASTERPAGE;
1283 case 3 : // notes
1284 ePageKind = PK_NOTES;
1285 break;
1286 case 4 : // handout
1287 ePageKind = PK_HANDOUT;
1288 break;
1289 default :
1290 case 1 : // normal
1291 break;
1293 pFrameView->SetPageKind( ePageKind );
1294 pFrameView->SetSelectedPage( nSelectedPage );
1295 pFrameView->SetViewShEditMode( eEditMode, ePageKind );
1298 DffRecordHeader aCustomShowHeader;
1299 // custom show einlesen und setzen
1300 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
1301 if ( SeekToRec( rStCtrl, PPT_PST_NamedShows, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
1303 DffRecordHeader aCuHeader;
1304 while( SeekToRec( rStCtrl, PPT_PST_NamedShow, aCustomShowHeader.GetRecEndFilePos(), &aCuHeader ) )
1306 DffRecordHeader aContent;
1307 if ( SeekToRec( rStCtrl, PPT_PST_CString, aCuHeader.GetRecEndFilePos(), &aContent ) )
1309 String aCuShow;
1310 aContent.SeekToBegOfRecord( rStCtrl );
1311 if ( ReadString( aCuShow ) )
1313 if ( SeekToRec( rStCtrl, PPT_PST_NamedShowSlides, aCuHeader.GetRecEndFilePos(), &aContent ) )
1315 PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
1316 UINT32 nSCount = aContent.nRecLen >> 2;
1317 if ( pPageList && nSCount )
1319 List* pList = mpDoc->GetCustomShowList( TRUE );
1320 if ( pList )
1322 SdCustomShow* pSdCustomShow = new SdCustomShow( mpDoc );
1323 if ( pSdCustomShow )
1325 pSdCustomShow->SetName( aCuShow );
1326 UINT32 nFound = 0;
1327 for ( UINT32 nS = 0; nS < nSCount; nS++ )
1329 UINT32 nPageNumber;
1330 rStCtrl >> nPageNumber;
1331 USHORT nPage = pPageList->FindPage( nPageNumber );
1332 if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
1334 SdPage* pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
1335 if ( pPage )
1337 pSdCustomShow->Insert( pPage, LIST_APPEND );
1338 nFound++;
1342 if ( nFound )
1343 pList->Insert( pSdCustomShow, LIST_APPEND );
1344 else
1345 delete pSdCustomShow;
1354 // this is defaulted, maybe there is no SSDocInfoAtom
1355 String aCustomShow;
1356 sal_uInt32 nFlags = 1; // Bit 0: Auto advance
1357 sal_uInt32 nPenColor = 0x1000000;
1358 sal_Int32 nRestartTime = 0x7fffffff;
1359 sal_uInt16 nStartSlide = 0;
1360 sal_Int16 nEndSlide = 0;
1362 // read the pres. configuration
1363 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
1364 if ( SeekToRec( rStCtrl, PPT_PST_SSDocInfoAtom, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
1366 rStCtrl >> nPenColor
1367 >> nRestartTime
1368 >> nStartSlide
1369 >> nEndSlide;
1371 sal_Unicode nChar;
1372 for ( UINT32 i2 = 0; i2 < 32; i2++ )
1374 rStCtrl >> nChar;
1375 if ( nChar )
1376 aCustomShow.Append( nChar );
1377 else
1379 rStCtrl.SeekRel( ( 31 - i2 ) << 1 );
1380 break;
1383 rStCtrl >> nFlags;
1385 // set the current custom show
1386 if ( aCustomShow.Len() )
1388 void* pPtr;
1389 List* pList = mpDoc->GetCustomShowList( FALSE );
1390 if ( pList )
1392 for ( pPtr = pList->First(); pPtr; pPtr = pList->Next() )
1394 if ( ((SdCustomShow*)pPtr)->GetName() == aCustomShow )
1395 break;
1397 if ( !pPtr )
1398 pList->First();
1401 sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
1403 rPresSettings.mbManual = ( nFlags & 1 ) == 0;
1404 rPresSettings.mbAnimationAllowed = ( nFlags & 2 ) == 0;
1405 rPresSettings.mbAll = ( nFlags & 4 ) == 0;
1406 rPresSettings.mbCustomShow = ( nFlags & 8 ) != 0;
1407 rPresSettings.mbEndless = ( nFlags & 0x80 ) != 0;
1408 rPresSettings.mbFullScreen = ( nFlags & 0x10 ) == 0;
1409 // rPresSettings.mnPauseTimeout;
1410 // rPresSettings.mbShowLogo;
1411 if ( nStartSlide && ( nStartSlide <= GetPageCount() ) )
1413 SdPage* pPage = mpDoc->GetSdPage( nStartSlide - 1, PK_STANDARD );
1414 if ( pPage )
1415 rPresSettings.maPresPage = pPage->GetName();
1419 delete pStbMgr;
1421 // read DocumentInfo
1422 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1423 mpDoc->GetObjectShell()->GetModel(), uno::UNO_QUERY_THROW);
1424 uno::Reference<document::XDocumentProperties> xDocProps
1425 = xDPS->getDocumentProperties();
1426 sfx2::LoadOlePropertySet(xDocProps, &mrStorage);
1427 xDocProps->setTemplateName(::rtl::OUString());
1429 pSdrModel->setLock( sal_False );
1430 return bOk;
1433 void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist )
1435 sal_uInt32 i;
1436 PptSlidePersistList* pList = GetPageList( eAktPageKind );
1437 if ( ( !pList ) || ( pList->Count() <= nAktPageNum ) )
1438 return;
1439 PptSlidePersistEntry& rSlidePersist = *(*pList)[ nAktPageNum ];
1440 HeaderFooterEntry* pHFE = rSlidePersist.pHeaderFooterEntry;
1441 if ( pHFE )
1443 for ( i = 0; i < 4; i++ )
1445 bool bVisible = pHFE->IsToDisplay( i );
1446 if ( ( eAktPageKind == PPT_SLIDEPAGE )
1447 && ( rSlidePersist.aSlideAtom.aLayout.eLayout == PPT_LAYOUT_TITLESLIDE )
1448 && ( aDocAtom.bTitlePlaceholdersOmitted == TRUE ) )
1450 bVisible = sal_False;
1452 if ( bVisible && pMasterPersist )
1454 sal_uInt32 nPosition = pHFE->NeedToImportInstance( i, rSlidePersist );
1455 if ( nPosition )
1457 Rectangle aEmpty;
1458 bVisible = sal_False;
1459 rStCtrl.Seek( nPosition );
1460 ProcessData aProcessData( rSlidePersist, (SdPage*)pPage );
1461 SdrObject* pObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
1462 if ( pObj )
1463 pPage->NbcInsertObject( pObj, 0 );
1466 String aPlaceHolderString;
1467 if ( pHFE->pPlaceholder )
1468 aPlaceHolderString = pHFE->pPlaceholder[ i ];
1470 sd::HeaderFooterSettings rHeaderFooterSettings( pPage->getHeaderFooterSettings() );
1471 switch( i )
1473 case 0 :
1475 rHeaderFooterSettings.mbDateTimeVisible = bVisible;
1476 rHeaderFooterSettings.mbDateTimeIsFixed = ( pHFE->nAtom & 0x20000 ) == 0;
1477 rHeaderFooterSettings.maDateTimeText = aPlaceHolderString;
1478 SvxDateFormat eDateFormat;
1479 SvxTimeFormat eTimeFormat;
1480 PPTFieldEntry::GetDateTime( pHFE->nAtom & 0xff, eDateFormat, eTimeFormat );
1481 rHeaderFooterSettings.meDateTimeFormat = eDateFormat | ( eTimeFormat << 4 );
1483 break;
1484 case 1 :
1486 rHeaderFooterSettings.mbHeaderVisible = bVisible;
1487 rHeaderFooterSettings.maHeaderText = aPlaceHolderString;
1489 break;
1490 case 2 :
1492 rHeaderFooterSettings.mbFooterVisible = bVisible;
1493 rHeaderFooterSettings.maFooterText = aPlaceHolderString;
1495 break;
1496 case 3 :
1498 rHeaderFooterSettings.mbSlideNumberVisible = bVisible;
1500 break;
1502 pPage->setHeaderFooterSettings( rHeaderFooterSettings );
1507 //////////////////////////////////////////////////////////////////////////
1509 // Import von Seiten
1511 //////////////////////////////////////////////////////////////////////////
1513 struct Ppt97AnimationStlSortHelper
1515 bool operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 );
1518 bool Ppt97AnimationStlSortHelper::operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 )
1520 if( !p1.second.get() || !p2.second.get() )
1521 return true;
1522 if( *p1.second < *p2.second )
1523 return true;
1524 if( *p1.second > *p2.second )
1525 return false;
1526 if( p1.first->GetOrdNum() < p2.first->GetOrdNum() )
1527 return true;
1528 return false;
1531 void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimationsUsed )
1533 ULONG nFilePosMerk = rStCtrl.Tell();
1535 // PageKind an der Seite setzen (bisher nur PK_STANDARD oder PK_NOTES)
1536 if ( pPage->GetPageKind() == PK_STANDARD )
1538 PptSlidePersistList* pPersistList = GetPageList( eAktPageKind );
1539 PptSlidePersistEntry* pActualSlidePersist = ( pPersistList && ( nAktPageNum < pPersistList->Count() ) )
1540 ? (*pPersistList)[ nAktPageNum ] : NULL;
1542 if ( pActualSlidePersist && ( eAktPageKind == PPT_SLIDEPAGE ) )
1544 if ( ! ( pActualSlidePersist->aSlideAtom.nFlags & 1 ) ) // do not follow master objects ?
1546 if(pPage->TRG_HasMasterPage())
1548 SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1549 aVisibleLayers.Set(mnBackgroundObjectsLayerID, FALSE);
1550 pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
1554 DffRecordHeader aPageRecHd;
1555 if ( pPage && SeekToAktPage( &aPageRecHd ) )
1557 ULONG nPageRecEnd = aPageRecHd.GetRecEndFilePos();
1559 BOOL bTryTwice = ( eAktPageKind == PPT_SLIDEPAGE );
1560 BOOL bSSSlideInfoAtom = FALSE;
1561 while ( TRUE )
1563 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nPageRecEnd ) )
1565 DffRecordHeader aHd;
1566 rStCtrl >> aHd;
1567 switch ( aHd.nRecType )
1569 case PPT_PST_SSSlideInfoAtom:
1571 bSSSlideInfoAtom = TRUE;
1572 if ( eAktPageKind == PPT_MASTERPAGE )
1574 if ( pActualSlidePersist )
1575 pActualSlidePersist->aPersistAtom.nReserved = aHd.GetRecBegFilePos();
1577 else
1579 sal_Int8 nDirection, nTransitionType, nByteDummy, nSpeed;
1580 sal_Int16 nBuildFlags;
1581 sal_Int32 nSlideTime, nSoundRef;
1582 rStCtrl >> nSlideTime // Standzeit (in Ticks)
1583 >> nSoundRef // Index in SoundCollection
1584 >> nDirection // Richtung des Ueberblendeffekts
1585 >> nTransitionType // Ueberblendeffekt
1586 >> nBuildFlags // Buildflags (s.u.)
1587 >> nSpeed // Geschwindigkeit (langsam, mittel, schnell)
1588 >> nByteDummy >> nByteDummy >> nByteDummy;
1590 switch ( nTransitionType )
1592 case PPT_TRANSITION_TYPE_BLINDS :
1594 if ( nDirection == 0 )
1595 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES );// Vertikal blenden
1596 else if ( nDirection == 1 )
1597 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES );// Horizontal blenden
1599 break;
1600 case PPT_TRANSITION_TYPE_CHECKER :
1602 if ( nDirection == 0 )
1603 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD );// Vertikal versetzt einblenden ??
1604 else if ( nDirection == 1 )
1605 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD );// Horizontal versetzt einblenden ??
1607 break;
1608 case PPT_TRANSITION_TYPE_COVER :
1610 if ( nDirection == 0 )
1611 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT ); // Von rechts ueberdecken
1612 else if ( nDirection == 1 )
1613 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM ); // Von unten ueberdecken
1614 else if ( nDirection == 2 )
1615 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT ); // Von links ueberdecken
1616 else if ( nDirection == 3 )
1617 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP ); // Von oben ueberdecken
1618 else if ( nDirection == 4 )
1619 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT );// Von rechts unten ueberdecken ??
1620 else if ( nDirection == 5 )
1621 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT ); // Von links unten ueberdecken ??
1622 else if ( nDirection == 6 )
1623 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT );// Von rechts oben ueberdecken
1624 else if ( nDirection == 7 )
1625 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT ); // Von links oben ueberdecken ??
1627 break;
1628 case PPT_TRANSITION_TYPE_NONE :
1630 if ( nBuildFlags )
1632 if ( nDirection == 0 )
1633 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_NONE ); // Direkt
1634 else if ( nDirection == 1 )
1636 pPage->setTransitionType( animations::TransitionType::BARWIPE );
1637 pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
1638 pPage->setTransitionFadeColor( 0 );
1641 else
1642 pPage->setTransitionType( 0 );
1644 break;
1645 case PPT_TRANSITION_TYPE_DISSOLVE :
1646 pPage->SetFadeEffect(::com::sun::star::presentation::FadeEffect_DISSOLVE); // Aufloesen
1647 break;
1648 case PPT_TRANSITION_TYPE_RANDOM_BARS :
1650 if ( nDirection == 0 )
1651 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES ); // Horizontale Linien
1652 else if ( nDirection == 1 )
1653 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES ); // Vertikale Linien
1655 break;
1656 case PPT_TRANSITION_TYPE_SPLIT :
1658 if ( nDirection == 0 )
1659 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL ); // Horizontal oeffnen
1660 else if ( nDirection == 1 )
1661 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL ); // Horizontal schliessen
1662 else if ( nDirection == 2 )
1663 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL ); // Vertikal oeffnen
1664 else if ( nDirection == 3 )
1665 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL );// Vertikal schliessen
1667 break;
1668 case PPT_TRANSITION_TYPE_STRIPS :
1670 if ( nDirection == 4 )
1671 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT );// Diagonal nach links oben
1672 else if ( nDirection == 5 )
1673 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT ); // Diagonal nach rechts oben
1674 else if ( nDirection == 6 )
1675 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT );// Diagonal nach links unten
1676 else if ( nDirection == 7 )
1677 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT ); // Diagonal nach rechts unten
1679 break;
1680 case PPT_TRANSITION_TYPE_PULL :
1682 if ( nDirection == 0 )
1683 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT ); // Nach links aufdecken
1684 else if ( nDirection == 1 )
1685 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP ); // Nach oben aufdecken
1686 else if ( nDirection == 2 )
1687 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT ); // Nach rechts aufdecken
1688 else if ( nDirection == 3 )
1689 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM ); // Nach unten aufdecken
1690 else if ( nDirection == 4 )
1691 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT );// Nach links oben aufdecken
1692 else if ( nDirection == 5 )
1693 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT );// Nach rechts oben aufdecken
1694 else if ( nDirection == 6 )
1695 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT );// Nach links unten aufdecken
1696 else if ( nDirection == 7 )
1697 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT );// Nach rechts unten aufdecken
1699 break;
1700 case PPT_TRANSITION_TYPE_WIPE :
1702 if ( nDirection == 0 )
1703 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT ); // Von rechts rollen
1704 else if ( nDirection == 1 )
1705 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM );// Von unten rollen
1706 else if ( nDirection == 2 )
1707 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT ); // Von links rollen
1708 else if ( nDirection == 3 )
1709 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP ); // Von oben rollen
1711 break;
1712 case PPT_TRANSITION_TYPE_RANDOM :
1713 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_RANDOM ); // Automatisch
1714 break;
1715 case PPT_TRANSITION_TYPE_FADE :
1717 pPage->setTransitionType( animations::TransitionType::FADE );
1718 pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
1719 pPage->setTransitionFadeColor( 0 );
1721 break;
1722 case PPT_TRANSITION_TYPE_ZOOM :
1724 if ( nDirection == 0 )
1725 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER );// Von innen einblenden
1726 else if ( nDirection == 1 )
1727 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER ); // Von aussen einblenden
1729 break;
1730 case PPT_TRANSITION_TYPE_DIAMOND :
1732 pPage->setTransitionType( animations::TransitionType::IRISWIPE );
1733 pPage->setTransitionSubtype( animations::TransitionSubType::DIAMOND );
1735 break;
1736 case PPT_TRANSITION_TYPE_PLUS :
1738 pPage->setTransitionType( animations::TransitionType::FOURBOXWIPE );
1739 pPage->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT );
1741 break;
1742 case PPT_TRANSITION_TYPE_CIRCLE :
1744 pPage->setTransitionType( animations::TransitionType::ELLIPSEWIPE );
1745 pPage->setTransitionSubtype( animations::TransitionSubType::CIRCLE );
1747 break;
1748 case PPT_TRANSITION_TYPE_WEDGE :
1750 pPage->setTransitionType( animations::TransitionType::FANWIPE );
1751 pPage->setTransitionSubtype( animations::TransitionSubType::CENTERTOP );
1753 break;
1754 case PPT_TRANSITION_TYPE_WHEEL :
1756 pPage->setTransitionType( animations::TransitionType::PINWHEELWIPE );
1757 sal_Int16 nSubType;
1758 switch( nDirection )
1760 default:
1761 case 1 : nSubType = animations::TransitionSubType::ONEBLADE; break;
1762 case 2 : nSubType = animations::TransitionSubType::TWOBLADEVERTICAL; break;
1763 case 3 : nSubType = animations::TransitionSubType::THREEBLADE; break;
1764 case 4 : nSubType = animations::TransitionSubType::FOURBLADE; break;
1765 case 8 : nSubType = animations::TransitionSubType::EIGHTBLADE; break;
1767 pPage->setTransitionSubtype( nSubType );
1769 break;
1770 case PPT_TRANSITION_TYPE_PUSH :
1772 pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
1773 sal_Int16 nSubType;
1774 switch( nDirection )
1776 default:
1777 case 0 : nSubType = animations::TransitionSubType::FROMRIGHT; break;
1778 case 1 : nSubType = animations::TransitionSubType::FROMBOTTOM; break;
1779 case 2 : nSubType = animations::TransitionSubType::FROMLEFT; break;
1780 case 3 : nSubType = animations::TransitionSubType::FROMTOP; break;
1782 pPage->setTransitionSubtype( nSubType );
1784 break;
1785 case PPT_TRANSITION_TYPE_COMB :
1787 pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
1788 pPage->setTransitionSubtype( nDirection ? animations::TransitionSubType::COMBVERTICAL : animations::TransitionSubType::COMBHORIZONTAL );
1790 break;
1791 case PPT_TRANSITION_TYPE_NEWSFLASH :
1793 pPage->setTransitionType( animations::TransitionType::FOURBOXWIPE );
1794 pPage->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT );
1796 pPage->setTransitionType( animations::TransitionType::ZOOM );
1797 pPage->setTransitionSubtype( animations::TransitionSubType::ROTATEIN );
1800 break;
1801 case PPT_TRANSITION_TYPE_SMOOTHFADE :
1803 pPage->setTransitionType( animations::TransitionType::FADE );
1804 pPage->setTransitionSubtype( animations::TransitionSubType::CROSSFADE );
1806 break;
1809 if ( nSpeed == 0 )
1810 pPage->setTransitionDuration( 3.0 ); // langsam
1811 else if ( nSpeed == 1 )
1812 pPage->setTransitionDuration( 2.0 ); // mittel
1813 else if ( nSpeed == 2 )
1814 pPage->setTransitionDuration( 1.0 ); // schnell
1816 if ( nBuildFlags & 0x400 ) // slidechange by time
1817 { // Standzeit (in Ticks)
1818 pPage->SetPresChange( PRESCHANGE_AUTO );
1819 pPage->SetTime( nSlideTime / 1000 );
1821 else
1822 pPage->SetPresChange( mePresChange );
1824 // if ( nBuildFlags & 1 ) // slidechange by mouseclick
1825 // pPage->SetPresChange( mePresChange );
1827 if ( nBuildFlags & 4 )
1828 pPage->SetExcluded( TRUE ); // Dia nicht anzeigen
1829 if ( nBuildFlags & 16 )
1830 { // Dia mit Soundeffekt
1831 pPage->SetSound( TRUE );
1832 String aSoundFile( ReadSound( nSoundRef ) );
1833 pPage->SetSoundFile( aSoundFile );
1835 if ( nBuildFlags & ( 1 << 6 ) ) // Loop until next sound
1836 pPage->SetLoopSound( sal_True );
1837 if ( nBuildFlags & ( 1 << 8 ) ) // Stop the previous sound
1838 pPage->SetStopSound( sal_True );
1839 break;
1843 aHd.SeekToEndOfRecord( rStCtrl );
1845 if ( bTryTwice && ( bSSSlideInfoAtom == FALSE ) )
1847 bTryTwice = FALSE;
1848 if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
1850 USHORT nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
1851 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
1852 if ( pPageList && ( nMasterNum < pPageList->Count() ) )
1854 PptSlidePersistEntry* pE = (*pPageList)[ nMasterNum ];
1855 if ( pE )
1857 UINT32 nOfs = pE->aPersistAtom.nReserved;
1858 if ( nOfs )
1860 rStCtrl.Seek( nOfs );
1861 nPageRecEnd = nOfs + 16;
1862 continue;
1869 break;
1874 if ( !bNewAnimationsUsed )
1876 tAnimationVector aAnimationsOnThisPage;
1878 // add effects from page in correct order
1879 SdrObjListIter aSdrIter( *pPage, IM_FLAT );
1880 while ( aSdrIter.IsMore() )
1882 SdrObject* pObj = aSdrIter.Next();
1883 tAnimationMap::iterator aFound = maAnimations.find( pObj );
1884 if( aFound != maAnimations.end() )
1886 std::pair< SdrObject*, Ppt97AnimationPtr > aPair( (*aFound).first, (*aFound).second );
1887 aAnimationsOnThisPage.push_back( aPair );
1891 Ppt97AnimationStlSortHelper aSortHelper;
1892 std::sort( aAnimationsOnThisPage.begin(), aAnimationsOnThisPage.end(), aSortHelper );
1894 tAnimationVector::iterator aIter( aAnimationsOnThisPage.begin() );
1895 const tAnimationVector::iterator aEnd( aAnimationsOnThisPage.end() );
1897 for( ;aIter != aEnd; aIter++ )
1899 Ppt97AnimationPtr pPpt97Animation = (*aIter).second;;
1900 if( pPpt97Animation.get() )
1901 pPpt97Animation->createAndSetCustomAnimationEffect( (*aIter).first );
1904 rStCtrl.Seek( nFilePosMerk );
1907 //////////////////////////////////////////////////////////////////////////
1909 // Import von Sounds
1911 // Die Sounds werden nicht nur als String importiert sondern auch
1912 // in die Gallery einefuegt, falls dort noch nicht vorhanden.
1914 ///////////////////////////////////////////////////////////////////////////
1916 String ImplSdPPTImport::ReadSound(UINT32 nSoundRef) const
1918 String aRetval;
1919 UINT32 nPosMerk = rStCtrl.Tell();
1920 DffRecordHeader aDocHd;
1921 if ( SeekToDocument( &aDocHd ) )
1923 UINT32 nSoundLen = aDocHd.GetRecEndFilePos();
1924 DffRecordHeader aSoundBlockRecHd;
1925 if( SeekToRec( rStCtrl, PPT_PST_SoundCollection, nSoundLen, &aSoundBlockRecHd ) )
1927 UINT32 nDataLen = aSoundBlockRecHd.GetRecEndFilePos();
1928 DffRecordHeader aSoundRecHd;
1929 BOOL bRefStrValid = FALSE;
1930 BOOL bDone = FALSE;
1932 while( !bDone && SeekToRec( rStCtrl, PPT_PST_Sound, nDataLen, &aSoundRecHd ) )
1934 UINT32 nStrLen = aSoundRecHd.GetRecEndFilePos();
1935 String aRefStr;
1936 UINT32 nPosMerk2 = rStCtrl.Tell();
1937 if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 2 ) )
1939 if ( ReadString( aRefStr ) )
1940 bRefStrValid = TRUE;
1942 if ( bRefStrValid )
1944 if ( UniString::CreateFromInt32( nSoundRef ) == aRefStr )
1946 rStCtrl.Seek( nPosMerk2 );
1947 if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 0 ) )
1949 ReadString( aRetval );
1950 bDone = TRUE;
1954 if ( bDone )
1956 // ueberpruefen, ob diese Sound-Datei schon
1957 // existiert. Wenn nicht, exportiere diese
1958 // in unser lokales Sound-Verzeichnis.
1959 BOOL bSoundExists = FALSE;
1960 List* pSoundList = new List();
1962 GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, *pSoundList );
1963 GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, *pSoundList );
1965 for( ULONG n = 0; ( n < pSoundList->Count() ) && !bSoundExists; n++ )
1967 INetURLObject aURL( *(String*)pSoundList->GetObject( n ) );
1968 String aSoundName( aURL.GetName() );
1970 if( aSoundName == aRetval )
1972 aRetval = *(String*)pSoundList->GetObject( n );
1973 bSoundExists = TRUE;
1977 for ( void* pPtr = pSoundList->First(); pPtr; pPtr = pSoundList->Next() )
1978 delete (String*)pPtr;
1980 delete pSoundList;
1982 if ( !bSoundExists )
1984 rStCtrl.Seek( nPosMerk2 );
1985 DffRecordHeader aSoundDataRecHd;
1986 if ( SeekToRec( rStCtrl, PPT_PST_SoundData, nStrLen, &aSoundDataRecHd, 0 ) )
1988 String aGalleryDir( SvtPathOptions().GetGalleryPath() );
1989 INetURLObject aGalleryUserSound( aGalleryDir.GetToken( aGalleryDir.GetTokenCount( ';' ) - 1 ) );
1991 aGalleryUserSound.Append( aRetval );
1992 UINT32 nSoundDataLen = aSoundDataRecHd.nRecLen;
1993 UINT8* pBuf = new UINT8[ nSoundDataLen ];
1995 rStCtrl.Read( pBuf, nSoundDataLen );
1996 SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
1998 if( pOStm )
2000 pOStm->Write( pBuf, nSoundDataLen );
2002 if( pOStm->GetError() == ERRCODE_NONE )
2004 GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ) );
2005 aRetval = aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE );
2008 delete pOStm;
2011 delete[] pBuf;
2015 if ( !bDone )
2016 aSoundRecHd.SeekToEndOfRecord( rStCtrl );
2020 rStCtrl.Seek( nPosMerk );
2021 return aRetval;
2024 //////////////////////////////////////////////////////////////////////////
2026 // media object import, the return value is the url to the media object
2028 //////////////////////////////////////////////////////////////////////////
2030 String ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
2032 String aRetVal;
2033 DffRecordHeader* pHd( const_cast<ImplSdPPTImport*>(this)->aDocRecManager.GetRecordHeader( PPT_PST_ExObjList, SEEK_FROM_BEGINNING ) );
2034 if ( pHd )
2036 pHd->SeekToContent( rStCtrl );
2037 while ( ( rStCtrl.Tell() < pHd->GetRecEndFilePos() ) && !aRetVal.Len() )
2039 DffRecordHeader aHdMovie;
2040 rStCtrl >> aHdMovie;
2041 switch( aHdMovie.nRecType )
2043 case PPT_PST_ExAviMovie :
2044 case PPT_PST_ExMCIMovie :
2046 DffRecordHeader aExVideoHd;
2047 if ( SeekToRec( rStCtrl, PPT_PST_ExVideo, aHdMovie.GetRecEndFilePos(), &aExVideoHd ) )
2049 DffRecordHeader aExMediaAtomHd;
2050 if ( SeekToRec( rStCtrl, PPT_PST_ExMediaAtom, aExVideoHd.GetRecEndFilePos(), &aExMediaAtomHd ) )
2052 sal_uInt32 nRef;
2053 rStCtrl >> nRef;
2054 if ( nRef == nMediaRef )
2056 aExVideoHd.SeekToContent( rStCtrl );
2057 while( rStCtrl.Tell() < aExVideoHd.GetRecEndFilePos() )
2059 DffRecordHeader aHd;
2060 rStCtrl >> aHd;
2061 switch( aHd.nRecType )
2063 case PPT_PST_CString :
2065 aHd.SeekToBegOfRecord( rStCtrl );
2066 String aStr;
2067 if ( ReadString( aStr ) )
2069 if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aStr, aRetVal ) )
2071 aRetVal = INetURLObject( aRetVal ).GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
2075 break;
2077 aHd.SeekToEndOfRecord( rStCtrl );
2079 break;
2084 break;
2086 aHdMovie.SeekToEndOfRecord( rStCtrl );
2089 return aRetVal;
2092 //////////////////////////////////////////////////////////////////////////
2094 // Import von Objekten
2096 //////////////////////////////////////////////////////////////////////////
2098 void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, String aMacroName )
2100 // Lokale Informationen in pInfo eintragen
2101 if( pIAtom->nSoundRef )
2103 pInfo->SetBookmark( ReadSound( pIAtom->nSoundRef ) ); // Pfad zum Soundfile in MSDOS-Notation
2104 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_SOUND; // RunProgramAction
2106 // if ( nFlags & 0x01 ) // koennen wir nicht ( beim Anklicken markieren )
2107 switch ( pIAtom->nAction )
2109 // case 0x01 : // MacroAction
2110 // {
2111 // pInfo->meClickAction = ::com::sun::star::presentation::::com::sun::star::presentation::ClickAction_MACRO;
2112 // // aMacro liegt in folgender Form vor:
2113 // // "Macroname.Modulname.Libname.Dokumentname" oder
2114 // // "Macroname.Modulname.Libname.Applikationsname"
2115 // pInfo->maBookmark = aMacroName;
2116 // }
2117 // break;
2118 case 0x02 : // RunProgramAction
2120 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
2121 pInfo->SetBookmark( aMacroName ); // Programmname in aBookmark
2123 break;
2124 case 0x03 : // JumpAction
2126 switch( pIAtom->nJump )
2128 case 0x01 :
2129 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NEXTPAGE; // Next slide
2130 break;
2131 case 0x02 :
2132 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Previous slide
2133 break;
2134 case 0x03 :
2135 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_FIRSTPAGE; // First slide
2136 break;
2137 case 0x04 :
2138 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_LASTPAGE; // last Slide
2139 break;
2140 case 0x05 :
2141 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Last slide viewed
2142 break;
2143 case 0x06 :
2144 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_STOPPRESENTATION; // End show
2145 break;
2146 default :
2147 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NONE; // 0x00: no action, else unknown
2148 break;
2151 break;
2152 case 0x04 :
2154 SdHyperlinkEntry* pPtr;
2155 for ( pPtr = (SdHyperlinkEntry*)aHyperList.First(); pPtr; pPtr = (SdHyperlinkEntry*)aHyperList.Next() )
2157 if ( pPtr->nIndex == pIAtom->nExHyperlinkId )
2158 break;
2160 if ( pPtr )
2162 switch( pIAtom->nHyperlinkType )
2164 case 9:
2165 case 8: // hyperlink : URL
2167 if ( pPtr->aTarget.Len() )
2169 ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
2170 if ( pDocShell )
2172 String aBaseURL = pDocShell->GetMedium()->GetBaseURL();
2173 String aBookmarkURL( pInfo->GetBookmark() );
2174 INetURLObject aURL( pPtr->aTarget );
2175 if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
2176 utl::LocalFileHelper::ConvertSystemPathToURL( pPtr->aTarget, aBaseURL, aBookmarkURL );
2177 if( !aBookmarkURL.Len() )
2178 aBookmarkURL = URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pPtr->aTarget, URIHelper::GetMaybeFileHdl(), true );
2179 pInfo->SetBookmark( aBookmarkURL );
2180 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
2184 break;
2186 case 10:
2187 break;
2189 case 7: // hyperlink auf eine Seite
2191 if ( pPtr->aConvSubString.Len() )
2193 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_BOOKMARK;
2194 pInfo->SetBookmark( pPtr->aConvSubString );
2197 break;
2201 break;
2202 case 0x05 : // OLEAction ( OLEVerb to use, 0==first, 1==secnd, .. )
2203 case 0x06 : // MediaAction
2204 case 0x07 : // CustomShowAction
2205 default : // 0x00: no action, else unknown action
2206 break;
2210 SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj, SdPage* pPage,
2211 SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
2213 SfxStyleSheet* pStyleSheetAry[ 9 ];
2214 SdrTextObj* pText = pObj;
2215 SdrObject* pRet = pText;
2217 ppStyleSheetAry = NULL;
2219 PresObjKind ePresKind = PRESOBJ_NONE;
2220 PptOEPlaceholderAtom* pPlaceHolder = pTextObj->GetOEPlaceHolderAtom();
2221 String aPresentationText;
2222 if ( pPlaceHolder )
2224 switch( pPlaceHolder->nPlaceholderId )
2226 case PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE :
2227 case PPT_PLACEHOLDER_MASTERCENTEREDTITLE :
2228 case PPT_PLACEHOLDER_MASTERTITLE :
2230 ePresKind = PRESOBJ_TITLE;
2231 aPresentationText = pPage->GetPresObjText( ePresKind );
2233 break;
2234 case PPT_PLACEHOLDER_MASTERBODY :
2236 ePresKind = PRESOBJ_OUTLINE;
2237 aPresentationText = pPage->GetPresObjText( ePresKind );
2239 break;
2240 case PPT_PLACEHOLDER_MASTERSUBTITLE :
2242 ePresKind = PRESOBJ_TEXT;
2243 aPresentationText = pPage->GetPresObjText( ePresKind );
2245 break;
2246 case PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE :
2248 ePresKind = PRESOBJ_NOTES;
2249 aPresentationText = pPage->GetPresObjText( ePresKind );
2251 break;
2252 case PPT_PLACEHOLDER_MASTERDATE : ePresKind = PRESOBJ_DATETIME; break;
2253 case PPT_PLACEHOLDER_MASTERSLIDENUMBER : ePresKind = PRESOBJ_SLIDENUMBER;break;
2254 case PPT_PLACEHOLDER_MASTERFOOTER : ePresKind = PRESOBJ_FOOTER; break;
2255 case PPT_PLACEHOLDER_MASTERHEADER : ePresKind = PRESOBJ_HEADER; break;
2258 switch ( pTextObj->GetDestinationInstance() )
2260 case TSS_TYPE_PAGETITLE :
2261 case TSS_TYPE_TITLE :
2263 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2264 if ( pSheet )
2265 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2266 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2268 break;
2269 case TSS_TYPE_SUBTITLE :
2271 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
2272 if ( pSheet )
2273 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2274 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" );
2276 break;
2277 case TSS_TYPE_BODY :
2278 case TSS_TYPE_HALFBODY :
2279 case TSS_TYPE_QUARTERBODY :
2281 for ( UINT16 nLevel = 9; nLevel; nLevel-- )
2283 String aName( pPage->GetLayoutName() );
2284 aName.Append( (sal_Unicode)( ' ' ) );
2285 aName.Append( String::CreateFromInt32( nLevel ) );
2286 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
2287 if ( pSheet )
2288 pText->StartListening( *pSheet );
2289 pStyleSheetAry[ nLevel - 1 ] = pSheet;
2291 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for outlinerobject (SJ)" );
2292 if ( pSheet )
2293 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2294 ppStyleSheetAry = &pStyleSheetAry[ 0 ];
2296 break;
2297 case TSS_TYPE_NOTES :
2299 if ( pPlaceHolder && ( ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_NOTESSLIDEIMAGE )
2300 || ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) ) )
2302 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2303 if ( pSheet )
2304 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2305 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2307 else
2309 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
2310 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for notesobj (SJ)" );
2311 if ( pSheet )
2312 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2315 break;
2316 case TSS_TYPE_UNUSED :
2317 case TSS_TYPE_TEXT_IN_SHAPE :
2319 switch( ePresKind )
2321 case PRESOBJ_DATETIME :
2322 case PRESOBJ_SLIDENUMBER :
2323 case PRESOBJ_FOOTER :
2324 case PRESOBJ_HEADER :
2325 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
2326 break;
2327 default :
2328 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
2331 break;
2333 pText = (SdrTextObj*)SdrPowerPointImport::ApplyTextObj( pTextObj, pText, pPage, pSheet, ppStyleSheetAry );
2334 if ( pPlaceHolder && pPlaceHolder->nPlaceholderId )
2336 if ( eAktPageKind == PPT_MASTERPAGE )
2338 sal_Bool bCreatePlaceHolder = ( pTextObj->GetInstance() != TSS_TYPE_SUBTITLE ) && ( pTextObj->GetInstance() != TSS_TYPE_UNUSED );
2339 sal_Bool bIsHeaderFooter = ( ePresKind == PRESOBJ_HEADER) || (ePresKind == PRESOBJ_FOOTER)
2340 || (ePresKind == PRESOBJ_DATETIME) || (ePresKind == PRESOBJ_SLIDENUMBER);
2341 if ( bCreatePlaceHolder && ( pTextObj->GetInstance() == TSS_TYPE_TEXT_IN_SHAPE ) )
2342 bCreatePlaceHolder = bIsHeaderFooter;
2343 if ( bCreatePlaceHolder )
2345 if ( !bIsHeaderFooter )
2347 pText->SetNotVisibleAsMaster( TRUE );
2348 pText->SetEmptyPresObj( TRUE );
2350 pText->SetUserCall( pPage );
2351 pPage->InsertPresObj( pText, ePresKind );
2352 SdrOutliner* pOutl = NULL;
2353 if ( pTextObj->GetInstance() == TSS_TYPE_NOTES )
2354 pOutl = GetDrawOutliner( pText );
2355 if ( aPresentationText.Len() )
2356 pPage->SetObjText( (SdrTextObj*)pText, pOutl, ePresKind, aPresentationText );
2358 SfxStyleSheet* pSheet2( pPage->GetStyleSheetForPresObj( ePresKind ) );
2359 if ( pSheet2 )
2361 SfxItemSet& rItemSet = pSheet2->GetItemSet();
2362 rItemSet.Put( (SdrTextLeftDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LEFTDIST ) );
2363 rItemSet.Put( (SdrTextRightDistItem&)pText->GetMergedItem( SDRATTR_TEXT_RIGHTDIST ) );
2364 rItemSet.Put( (SdrTextUpperDistItem&)pText->GetMergedItem( SDRATTR_TEXT_UPPERDIST ) );
2365 rItemSet.Put( (SdrTextLowerDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LOWERDIST ) );
2367 pText->NbcSetStyleSheet( pSheet2, TRUE );
2369 SfxItemSet aTempAttr( mpDoc->GetPool() );
2370 SdrTextMinFrameHeightItem aMinHeight( pText->GetLogicRect().GetSize().Height() );
2371 aTempAttr.Put( aMinHeight );
2372 SdrTextAutoGrowHeightItem aAutoGrowHeight( FALSE );
2373 aTempAttr.Put( aAutoGrowHeight );
2374 pText->SetMergedItemSet(aTempAttr);
2376 else
2378 pRet = NULL;
2381 else
2383 const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
2384 if ( pSlideLayout || ( eAktPageKind == PPT_NOTEPAGE ) )
2386 INT16 nPlaceholderId = pPlaceHolder->nPlaceholderId;
2387 UINT16 i = 0;
2388 if ( eAktPageKind == PPT_SLIDEPAGE )
2390 for ( ; i < 8; i++ )
2392 if ( pSlideLayout->aPlaceholderId[ i ] == nPlaceholderId )
2393 break;
2396 if ( i < 8 )
2398 PresObjKind ePresObjKind = PRESOBJ_NONE;
2399 sal_Bool bEmptyPresObj = sal_True;
2400 sal_Bool bVertical = sal_False;
2401 if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
2403 if ( pTextObj->Count() )
2404 bEmptyPresObj = sal_False;
2405 switch ( nPlaceholderId )
2407 case PPT_PLACEHOLDER_NOTESBODY : ePresObjKind = PRESOBJ_NOTES; break;
2408 case PPT_PLACEHOLDER_VERTICALTEXTTITLE :
2409 bVertical = sal_True; // PASSTHROUGH !!!
2410 case PPT_PLACEHOLDER_TITLE : ePresObjKind = PRESOBJ_TITLE; break;
2411 case PPT_PLACEHOLDER_VERTICALTEXTBODY :
2412 bVertical = sal_True; // PASSTHROUGH !!!
2413 case PPT_PLACEHOLDER_BODY : ePresObjKind = PRESOBJ_OUTLINE; break;
2414 case PPT_PLACEHOLDER_CENTEREDTITLE : ePresObjKind = PRESOBJ_TITLE; break;
2415 case PPT_PLACEHOLDER_SUBTITLE : ePresObjKind = PRESOBJ_TEXT; break; // PRESOBJ_OUTLINE
2417 default :
2419 if ( !pTextObj->Count() )
2421 switch ( nPlaceholderId )
2423 case PPT_PLACEHOLDER_MEDIACLIP :
2424 case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
2425 case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
2426 case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_TABLE; break;
2427 case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
2428 case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
2434 else if ( pTextObj->GetShapeType() == mso_sptPictureFrame )
2436 if ( !pTextObj->Count() && pObj->ISA( SdrGrafObj ) )
2438 bEmptyPresObj = sal_False;
2439 switch ( nPlaceholderId )
2441 case PPT_PLACEHOLDER_MEDIACLIP :
2442 case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
2443 case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
2444 case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_TABLE; break;
2445 case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
2446 case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
2450 if ( ePresObjKind != PRESOBJ_NONE )
2452 if ( !bEmptyPresObj )
2454 pPage->InsertPresObj( pRet, ePresObjKind );
2456 else
2458 SdrObject* pPresObj = pPage->CreatePresObj( ePresObjKind, bVertical, pText->GetLogicRect(), TRUE );
2459 pPresObj->SetUserCall( pPage );
2461 SfxItemSet aSet( pSdrModel->GetItemPool() );
2462 ApplyAttributes( rStCtrl, aSet );
2463 pPresObj->SetMergedItemSet(aSet);
2465 if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( pSlideLayout->aPlacementId[ i ] != (ULONG)-1 ) )
2467 SdrObject* pTitleObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
2468 SdrObject* pOutlineObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
2470 Rectangle aTitleRect;
2471 Rectangle aOutlineRect;
2472 Size aOutlineSize;
2474 if ( pTitleObj )
2475 aTitleRect = pTitleObj->GetLogicRect();
2476 if ( pOutlineObj )
2478 aOutlineRect = pOutlineObj->GetLogicRect();
2479 aOutlineSize = aOutlineRect.GetSize();
2481 Rectangle aLogicRect( pPresObj->GetLogicRect() );
2482 Size aLogicSize( aLogicRect.GetSize() );
2484 switch ( pSlideLayout->aPlacementId[ i ] )
2486 case 0 : // Lage im Titelbereich
2488 if ( aLogicRect != aTitleRect )
2489 pPresObj->SetUserCall( NULL );
2491 break;
2493 case 1:
2495 if ( pSlideLayout->eLayout == PPT_LAYOUT_TITLEANDBODYSLIDE )
2496 { // Lage im Outlinebereich
2497 if ( aLogicRect != aOutlineRect )
2498 pPresObj->SetUserCall( NULL );
2500 else if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
2501 { // Lage im Outlinebereich links
2502 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2503 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2504 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2505 aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
2506 aLogicSize.Width() / aOutlineSize.Width() > 0.5)
2508 pPresObj->SetUserCall(NULL);
2511 else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
2512 { // Lage im Outlinebereich oben
2513 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2514 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2515 Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
2517 pPresObj->SetUserCall( NULL );
2520 else if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2521 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
2522 { // Lage im Outlinebereich links oben
2523 pPresObj->SetUserCall( NULL );
2526 break;
2528 case 2:
2530 if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
2531 { // Lage im Outlinebereich rechts
2532 if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2533 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2534 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2535 aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
2536 aLogicSize.Width() / aOutlineSize.Width() > 0.5)
2538 pPresObj->SetUserCall( NULL );
2541 else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
2542 { // Lage im Outlinebereich unten
2543 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2544 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2545 Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
2547 pPresObj->SetUserCall( NULL );
2550 else if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2551 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
2552 { // Lage im Outlinebereich rechts oben
2553 pPresObj->SetUserCall(NULL);
2556 break;
2558 case 3:
2559 { // Lage im Outlinebereich links unten
2560 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2561 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
2563 pPresObj->SetUserCall( NULL );
2566 break;
2568 case 4:
2569 { // Lage im Outlinebereich rechts unten
2570 if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2571 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
2573 pObj->SetUserCall( NULL );
2576 break;
2579 pRet = NULL; // return zero cause this obj was already inserted by CreatePresObj
2582 else if ( !pTextObj->Count() )
2583 pRet = NULL;
2588 if ( pRet != pText )
2590 SdrObject* pFree( pText );
2591 SdrObject::Free( pFree );
2593 return pRet;
2596 SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pRet )
2598 SdrObject* pObj = SdrPowerPointImport::ProcessObj( rSt, rObjData, pData, rTextRect, pRet );
2600 // Animationseffekte des Objektes lesen
2601 if ( pObj )
2603 // further setup placeholder objects
2604 if( pObj->ISA(SdrPageObj) && pData )
2606 const ProcessData* pProcessData=(const ProcessData*)pData;
2607 if( pProcessData->pPage )
2608 pProcessData->pPage->InsertPresObj( pObj, PRESOBJ_PAGE );
2611 BOOL bInhabitanceChecked = FALSE;
2612 BOOL bAnimationInfoFound = FALSE;
2613 DffRecordHeader aMasterShapeHd;
2615 if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
2617 DffRecordHeader& rHdClientData = *maShapeRecords.Current();
2618 while( TRUE )
2620 UINT32 nClientDataLen = rHdClientData.GetRecEndFilePos();
2621 DffRecordHeader aHd;
2624 rSt >> aHd;
2625 UINT32 nHdRecEnd = aHd.GetRecEndFilePos();
2626 switch ( aHd.nRecType )
2628 case PPT_PST_AnimationInfo :
2630 DffRecordHeader aHdAnimInfoAtom;
2631 if ( SeekToRec( rSt, PPT_PST_AnimationInfoAtom, nHdRecEnd, &aHdAnimInfoAtom ) )
2633 // read data from stream
2634 Ppt97AnimationPtr pAnimation( new Ppt97Animation( rSt ) );
2635 // store animation informations
2636 if( pAnimation->HasEffect() )
2638 // translate color to RGB
2639 pAnimation->SetDimColor( MSO_CLR_ToColor(pAnimation->GetDimColor()).GetColor() );
2640 // translate sound bits to file url
2641 if( pAnimation->HasSoundEffect() )
2642 pAnimation->SetSoundFileUrl( ReadSound( pAnimation->GetSoundRef() ) );
2644 bool bDontAnimateInvisibleShape = false;
2646 SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
2648 if( pTextObj && pTextObj->HasText() &&
2649 !pObj->ISA( SdrObjGroup ) &&
2650 pAnimation->HasAnimateAssociatedShape() )
2652 const SfxItemSet& rObjItemSet = pObj->GetMergedItemSet();
2654 XFillStyle eFillStyle = ((XFillStyleItem&)(rObjItemSet.Get(XATTR_FILLSTYLE))).GetValue();
2655 XLineStyle eLineStyle = ((XLineStyleItem&)(rObjItemSet.Get(XATTR_LINESTYLE))).GetValue();
2657 if ( ( eFillStyle == XFILL_NONE ) && ( eLineStyle == XLINE_NONE ) )
2658 bDontAnimateInvisibleShape = true;
2661 if( bDontAnimateInvisibleShape )
2662 pAnimation->SetAnimateAssociatedShape(false);
2664 //maybe some actions necessary to ensure that animations on master pages are played before animations on normal pages
2665 ///mabe todo in future: bool bIsEffectOnMasterPage = !bInhabitanceChecked;?
2667 maAnimations[pObj] = pAnimation;
2669 bAnimationInfoFound = TRUE;
2673 break;
2674 case PPT_PST_InteractiveInfo:
2676 UINT32 nFilePosMerk2 = rSt.Tell();
2677 String aMacroName;
2679 if(SeekToRec( rSt, PPT_PST_CString, nHdRecEnd, NULL, 0 ) )
2680 ReadString(aMacroName);
2682 rSt.Seek( nFilePosMerk2 );
2683 DffRecordHeader aHdInteractiveInfoAtom;
2684 if ( SeekToRec( rSt, PPT_PST_InteractiveInfoAtom, nHdRecEnd, &aHdInteractiveInfoAtom ) )
2686 PptInteractiveInfoAtom aInteractiveInfoAtom;
2687 rSt >> aInteractiveInfoAtom;
2689 // interactive object
2690 SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
2692 ( (ImplSdPPTImport*) this )->FillSdAnimationInfo( pInfo, &aInteractiveInfoAtom, aMacroName );
2693 if ( aInteractiveInfoAtom.nAction == 6 ) // Sj -> media action
2695 rHdClientData.SeekToContent( rStCtrl );
2696 DffRecordHeader aObjRefAtomHd;
2697 if ( SeekToRec( rSt, PPT_PST_ExObjRefAtom, nHdRecEnd, &aObjRefAtomHd ) )
2699 sal_uInt32 nRef;
2700 rSt >> nRef;
2701 String aMediaURL( ReadMedia( nRef ) );
2702 if ( !aMediaURL.Len() )
2703 aMediaURL = ReadSound( nRef );
2704 if ( aMediaURL.Len() )
2706 SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() );
2707 pMediaObj->SetModel( pObj->GetModel() );
2708 pMediaObj->SetMergedItemSet( pObj->GetMergedItemSet() );
2710 //--remove object from maAnimations list and add the new object instead
2711 Ppt97AnimationPtr pAnimation;
2713 tAnimationMap::iterator aFound = maAnimations.find( pObj );
2714 if( aFound != maAnimations.end() )
2716 pAnimation = (*aFound).second;
2717 maAnimations.erase(aFound);
2719 maAnimations[pMediaObj] = pAnimation;
2721 //--
2723 SdrObject::Free( pObj ), pObj = pMediaObj; // SJ: hoping that pObj is not inserted in any list
2724 pMediaObj->setURL( aMediaURL );
2730 break;
2732 aHd.SeekToEndOfRecord( rSt );
2734 while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) );
2736 if ( bInhabitanceChecked || bAnimationInfoFound )
2737 break;
2738 bInhabitanceChecked = TRUE;
2739 if ( ! ( IsProperty( DFF_Prop_hspMaster ) && SeekToShape( rSt, pData, GetPropertyValue( DFF_Prop_hspMaster ) ) ) )
2740 break;
2741 rSt >> aMasterShapeHd;
2742 if ( !SeekToRec( rSt, DFF_msofbtClientData, aMasterShapeHd.GetRecEndFilePos(), &aMasterShapeHd ) )
2743 break;
2744 aMasterShapeHd.SeekToContent( rSt );
2745 rHdClientData = aMasterShapeHd;
2749 return pObj;
2752 // ---------------------
2753 // - exported function -
2754 // ---------------------
2756 extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL ImportPPT( const ::rtl::OUString& rConfigPath,
2757 uno::Sequence< beans::PropertyValue >* pConfigData,
2758 SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium )
2760 sal_Bool bRet = sal_False;
2762 MSFilterTracer aTracer( rConfigPath, pConfigData );
2763 aTracer.StartTracing();
2765 SdPPTImport* pImport = new SdPPTImport( pDocument, rDocStream, rStorage, rMedium, &aTracer );
2766 bRet = pImport->Import();
2768 aTracer.EndTracing();
2769 delete pImport;
2771 return bRet;