update m9
[ooovba.git] / sd / source / filter / ppt / pptin.cxx
blob4e92f7c23e3b478d4f65aac6c95a1a1a84f85392
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 <svx/svxids.hrc>
39 #include <svx/svdfppt.hxx>
40 #include <svx/svditer.hxx>
41 #include <sfx2/docfile.hxx>
42 #include <sfx2/app.hxx>
43 #include <svx/svdograf.hxx>
44 #include <svx/svdlayer.hxx>
45 #include <vcl/msgbox.hxx>
46 #include <svtools/style.hxx>
47 #include <svx/xflclit.hxx>
48 #include <svx/eeitem.hxx>
49 #include <svx/colritem.hxx>
50 #include <svtools/whiter.hxx>
51 #include <svx/xgrad.hxx>
52 #include <svx/xflgrit.hxx>
53 #include <svx/xbtmpit.hxx>
54 #include <svx/xlnclit.hxx>
55 #include <svx/adjitem.hxx>
56 #include <svx/editeng.hxx>
57 #include <svx/bulitem.hxx>
58 #include <svx/lrspitem.hxx>
59 #include <svx/lspcitem.hxx>
60 #include <svx/tstpitem.hxx>
62 #include <sfx2/docinf.hxx>
64 #include "glob.hrc"
65 #include "pptin.hxx"
66 #include "Outliner.hxx"
67 #include "drawdoc.hxx"
68 #include "sdpage.hxx"
69 #include "sdresid.hxx"
70 #include "pres.hxx"
71 #include "sdresid.hxx"
72 #include "stlpool.hxx"
73 #include "anminfo.hxx"
74 #include <svx/gallery.hxx>
75 #include <tools/urlobj.hxx>
76 #include <svx/numitem.hxx>
77 #include <svtools/itempool.hxx>
78 #include <svx/fhgtitem.hxx>
79 #include <svx/svdopage.hxx>
80 #include <svx/svdomedia.hxx>
81 #include <svx/svdogrp.hxx>
82 #include "propread.hxx"
83 #include <cusshow.hxx>
84 #include <vcl/bmpacc.hxx>
86 #include "../../ui/inc/DrawDocShell.hxx"
87 #include "../../ui/inc/FrameView.hxx"
88 #include "../../ui/inc/optsitem.hxx"
90 #include <svtools/fltrcfg.hxx>
91 #include <sfx2/progress.hxx>
92 #include <unotools/localfilehelper.hxx>
93 #include <svx/editstat.hxx>
94 #include <svtools/pathoptions.hxx>
95 #include <sfx2/docfac.hxx>
96 #define MAX_USER_MOVE 2
98 #include "pptinanimations.hxx"
99 #include "ppt97animations.hxx"
101 #include <com/sun/star/document/XDocumentProperties.hpp>
102 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
105 using namespace ::com::sun::star;
108 SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium, MSFilterTracer* pTracer )
111 sal_uInt32 nImportFlags = 0;
113 #ifdef DBG_UTIL
114 PropRead* pSummaryInformation = new PropRead( rStorage, String( RTL_CONSTASCII_USTRINGPARAM( "\005SummaryInformation" ) ) );
115 if ( pSummaryInformation->IsValid() )
117 pSummaryInformation->Read();
118 sal_uInt8 aPropSetGUID[ 16 ] =
120 0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9
122 Section* pSection = (Section*)pSummaryInformation->GetSection( aPropSetGUID );
123 if ( pSection )
125 PropItem aPropItem;
126 if ( pSection->GetProperty( PID_COMMENTS, aPropItem ) )
128 String aComment;
129 aPropItem.Read( aComment );
130 if ( aComment.Search( String( RTL_CONSTASCII_USTRINGPARAM( "Applixware" ) ), 0 ) != STRING_NOTFOUND )
132 nImportFlags |= PPT_IMPORTFLAGS_NO_TEXT_ASSERT;
137 delete pSummaryInformation;
138 #endif
140 PowerPointImportParam aParam( rDocStream, nImportFlags, pTracer );
141 SvStream* pCurrentUserStream = rStorage.OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) ), STREAM_STD_READ );
142 if( pCurrentUserStream )
144 *pCurrentUserStream >> aParam.aCurrentUserAtom;
145 delete pCurrentUserStream;
148 if( pDocument )
150 // iterate over all styles
151 SdStyleSheetPool* pStyleSheetPool = pDocument->GetSdStyleSheetPool();
153 sal_uInt32 nStyles = pStyleSheetPool ? pStyleSheetPool->GetStyles().size() : 0;
154 for (sal_uInt32 nStyle = 0; nStyle < nStyles; nStyle++)
156 SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pStyleSheetPool->GetStyles()[nStyle].get() );
157 SfxItemSet& rSet = pSheet->GetItemSet();
159 // if autokerning is set in style, override it, ppt has no autokerning
160 if( rSet.GetItemState( EE_CHAR_PAIRKERNING, FALSE ) == SFX_ITEM_SET )
161 rSet.ClearItem( EE_CHAR_PAIRKERNING );
165 pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
168 sal_Bool SdPPTImport::Import()
170 return pFilter->Import();
173 SdPPTImport::~SdPPTImport()
175 delete pFilter;
178 ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SvStorage& rStorage_, SfxMedium& rMedium, PowerPointImportParam& rParam )
179 : SdrPowerPointImport ( rParam, rMedium.GetBaseURL() )
180 , mrMed ( rMedium )
181 , mrStorage ( rStorage_ )
182 , mbDocumentFound ( FALSE )
183 , mnFilterOptions ( 0 )
185 mpDoc = pDocument;
186 if ( bOk )
188 mbDocumentFound = SeekToDocument( &maDocHd ); // maDocHd = the latest DocumentHeader
189 while ( SeekToRec( rStCtrl, PPT_PST_Document, nStreamLen, &maDocHd ) )
190 mbDocumentFound = TRUE;
192 UINT32 nDggContainerOfs = 0;
194 if ( mbDocumentFound )
196 ULONG nPosMerk = rStCtrl.Tell();
198 pStData = rStorage_.OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ), STREAM_STD_READ );
200 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
201 ULONG nDocLen = maDocHd.GetRecEndFilePos();
202 DffRecordHeader aPPDGHd;
203 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawingGroup, nDocLen, &aPPDGHd ) )
205 ULONG nPPDGLen = aPPDGHd.GetRecEndFilePos();
206 if ( SeekToRec( rStCtrl, DFF_msofbtDggContainer, nPPDGLen, NULL ) )
207 nDggContainerOfs = rStCtrl.Tell();
209 rStCtrl.Seek( nPosMerk );
211 sal_uInt32 nSvxMSDffOLEConvFlags2 = 0;
213 SvtFilterOptions* pBasOpt = SvtFilterOptions::Get();
214 if ( pBasOpt )
216 if ( pBasOpt->IsLoadPPointBasicCode() )
217 mnFilterOptions |= 1;
218 if ( pBasOpt->IsMathType2Math() )
219 nSvxMSDffOLEConvFlags2 |= OLE_MATHTYPE_2_STARMATH;
220 if ( pBasOpt->IsWinWord2Writer() )
221 nSvxMSDffOLEConvFlags2 |= OLE_WINWORD_2_STARWRITER;
222 if ( pBasOpt->IsExcel2Calc() )
223 nSvxMSDffOLEConvFlags2 |= OLE_EXCEL_2_STARCALC;
224 if ( pBasOpt->IsPowerPoint2Impress() )
225 nSvxMSDffOLEConvFlags2 |= OLE_POWERPOINT_2_STARIMPRESS;
228 InitSvxMSDffManager( nDggContainerOfs, pStData, nSvxMSDffOLEConvFlags2 );
229 SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS
230 | SVXMSDFF_SETTINGS_IMPORT_IAS | SVXMSDFF_SETTINGS_IMPORT_PPT );
231 SetModel( mpDoc, 576 );
235 //////////////////////////////////////////////////////////////////////////
237 // Dtor
239 //////////////////////////////////////////////////////////////////////////
241 ImplSdPPTImport::~ImplSdPPTImport()
243 for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
244 delete (String*)pPtr;
245 delete pStData;
248 //////////////////////////////////////////////////////////////////////////
250 // Import
252 //////////////////////////////////////////////////////////////////////////
254 sal_Bool ImplSdPPTImport::Import()
256 if ( !bOk )
257 return FALSE;
259 pSdrModel->setLock( sal_True );
260 SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
261 sal_uInt32 nControlWord = rOutl.GetEditEngine().GetControlWord();
262 nControlWord |= EE_CNTRL_ULSPACESUMMATION;
263 nControlWord &=~ EE_CNTRL_ULSPACEFIRSTPARA;
264 ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
266 SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
267 mnBackgroundLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), FALSE );
268 mnBackgroundObjectsLayerID = rAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), FALSE );
270 ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
271 if ( pDocShell )
272 SeekOle( pDocShell, mnFilterOptions );
274 // hyperlinks
275 PropRead* pDInfoSec2 = new PropRead( mrStorage, String( RTL_CONSTASCII_USTRINGPARAM( "\005DocumentSummaryInformation" ) ) );
276 if ( pDInfoSec2->IsValid() )
278 PropItem aPropItem;
280 UINT32 nType, nPropSize, nPropCount;
282 pDInfoSec2->Read();
284 BYTE aPropSetGUID[ 16 ] =
286 0x02, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
288 Section* pSection = (Section*)pDInfoSec2->GetSection( aPropSetGUID );
289 if ( pSection )
291 if ( pSection->GetProperty( PID_SLIDECOUNT, aPropItem ) )
293 aPropItem >> nType;
294 if ( ( nType == VT_I4 ) || ( nType == VT_UI4 ) )
296 // examine PID_HEADINGPAIR to get the correct entry for PID_DOCPARTS
297 UINT32 nSlideCount, nVecCount;
298 aPropItem >> nSlideCount;
299 if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
301 UINT32 nSlideTitleIndex = 0, nSlideTitleCount = 0;
302 UINT32 nFontIndex, nFontCount = 0;
303 UINT32 nDesignTemplateIndex, nDesignTemplateCount = 0;
304 UINT32 i, nTemp, nEntryCount = 0;
306 String aUString;
308 aPropItem >> nType
309 >> nVecCount;
311 if ( ( nType == ( VT_VARIANT | VT_VECTOR ) ) && ( nVecCount ^ 1 ) )
313 nVecCount >>= 1;
315 for ( i = 0; i < nVecCount; i++ )
317 if ( !aPropItem.Read( aUString, VT_EMPTY, FALSE ) )
318 break;
319 aPropItem >> nType;
320 if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
321 break;
322 aPropItem >> nTemp;
323 if ( aUString.EqualsAscii("Slide Titles") || aUString.EqualsAscii("Folientitel") )
325 nSlideTitleCount = nTemp;
326 nSlideTitleIndex = nEntryCount;
328 else if ( aUString.EqualsAscii("Fonts Used") )
330 nFontCount = nTemp;
331 nFontIndex = nEntryCount;
333 else if ( aUString.EqualsAscii("Design Template") )
335 nDesignTemplateCount = nTemp;
336 nDesignTemplateIndex = nEntryCount;
338 nEntryCount += nTemp;
341 if ( ( nSlideCount == nSlideTitleCount ) && pSection->GetProperty( PID_DOCPARTS, aPropItem ) )
343 aPropItem >> nType
344 >> nVecCount;
346 if ( ( nVecCount >= ( nSlideTitleIndex + nSlideTitleCount ) )
347 && ( nType == ( VT_LPSTR | VT_VECTOR ) ) )
349 for ( i = 0; i != nSlideTitleIndex; i++ )
351 aPropItem >> nTemp;
352 aPropItem.SeekRel( nTemp );
354 for ( i = 0; i < nSlideTitleCount; i++ )
356 if ( !aPropItem.Read( aUString, nType, FALSE ) )
357 break;
358 String* pString = new String( aUString );
359 if ( pString->EqualsAscii( "No Slide Title" ))
360 *pString = String();
361 else
363 void* pPtr;
364 for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
366 if ( *((String*)pPtr ) == *pString )
368 *pString = String();
369 break;
373 maSlideNameList.Insert( pString, LIST_APPEND );
381 BYTE aUserPropSetGUID[ 16 ] =
383 0x05, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
385 pSection = (Section*)pDInfoSec2->GetSection( aUserPropSetGUID );
386 if ( pSection )
388 Dictionary aDict;
389 if ( pSection->GetDictionary( aDict ) )
391 UINT32 nPropId = aDict.GetProperty( rtl::OUString::createFromAscii("_PID_HLINKS" ));
392 if ( nPropId )
394 if ( pSection->GetProperty( nPropId, aPropItem ) )
396 aPropItem.Seek( STREAM_SEEK_TO_BEGIN );
397 aPropItem >> nType;
398 if ( nType == VT_BLOB )
400 aPropItem >> nPropSize
401 >> nPropCount;
403 if ( ! ( nPropCount % 6 ) )
405 UINT32 i;
407 nPropCount /= 6; // 6 propertys a hyperlink
409 SdHyperlinkEntry* pHyperlink = 0;
410 for ( i = 0; i < nPropCount; i++ )
412 pHyperlink = new SdHyperlinkEntry;
413 pHyperlink->nIndex = 0;
414 aPropItem >> nType;
415 if ( nType != VT_I4 )
416 break;
417 aPropItem >> pHyperlink->nPrivate1
418 >> nType;
419 if ( nType != VT_I4 )
420 break;
421 aPropItem >> pHyperlink->nPrivate2
422 >> nType;
423 if ( nType != VT_I4 )
424 break;
425 aPropItem >> pHyperlink->nPrivate3
426 >> nType;
427 if ( nType != VT_I4 )
428 break;
429 aPropItem >> pHyperlink->nInfo;
430 if ( !aPropItem.Read( pHyperlink->aTarget, VT_EMPTY ) )
431 break;
433 // #n382718# (and #n261623#) Convert '\\' notation to 'smb://'
434 INetURLObject aUrl( pHyperlink->aTarget, INET_PROT_FILE );
435 pHyperlink->aTarget = aUrl.GetMainURL( INetURLObject::NO_DECODE );
437 if ( !aPropItem.Read( pHyperlink->aSubAdress, VT_EMPTY ) )
438 break;
439 pHyperlink->nStartPos = pHyperlink->nEndPos = -1;
441 if ( pHyperlink->aSubAdress.Len() ) // get the converted subadress
443 sal_uInt32 nPageNumber = 0;
444 String aString( pHyperlink->aSubAdress );
445 ByteString aStringAry[ 3 ];
446 sal_uInt16 nTokenCount = aString.GetTokenCount( ',' );
447 if ( nTokenCount > 3 )
448 nTokenCount = 3;
449 sal_uInt16 nToken;
450 for( nToken = 0; nToken < nTokenCount; nToken++ )
451 aStringAry[ nToken ] = ByteString( aString.GetToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8 );
453 sal_Bool bSucceeded = sal_False;
455 // first pass, searching for a SlideId
456 for( nToken = 0; nToken < nTokenCount; nToken++ )
458 if ( aStringAry[ nToken ].IsNumericAscii() )
460 sal_Int32 nNumber = aStringAry[ nToken ].ToInt32();
461 if ( nNumber & ~0xff )
463 PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
464 if ( pPageList )
466 sal_uInt16 nPage = pPageList->FindPage( nNumber );
467 if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
469 nPageNumber = nPage;
470 bSucceeded = sal_True;
471 break;
477 if ( !bSucceeded )
478 { // second pass, searching for a SlideName
479 for ( nToken = 0; nToken < nTokenCount; nToken++ )
481 String aToken( aString.GetToken( nToken, (sal_Unicode)',' ) );
482 for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
484 if ( *(String*)pPtr == aToken )
486 nPageNumber = maSlideNameList.GetCurPos();
487 bSucceeded = sal_True;
488 break;
493 if ( !bSucceeded )
494 { // third pass, searching for a slide number
495 for ( nToken = 0; nToken < nTokenCount; nToken++ )
497 if ( aStringAry[ nToken ].IsNumericAscii() )
499 sal_Int32 nNumber = aStringAry[ nToken ].ToInt32();
500 if ( ( nNumber & ~0xff ) == 0 )
502 nPageNumber = (sal_uInt32)nNumber - 1;
503 bSucceeded = sal_True;
504 break;
509 if ( bSucceeded )
511 if ( nPageNumber < maSlideNameList.Count() )
512 pHyperlink->aConvSubString = *(String*)maSlideNameList.GetObject( nPageNumber );
513 if ( !pHyperlink->aConvSubString.Len() )
515 pHyperlink->aConvSubString = String( SdResId( STR_PAGE ) );
516 pHyperlink->aConvSubString.Append( sal_Unicode( ' ' ) );
517 pHyperlink->aConvSubString.Append( mpDoc->CreatePageNumValue( (USHORT)nPageNumber + 1 ) );
521 aHyperList.Insert( pHyperlink, LIST_APPEND );
523 if ( i != nPropCount )
524 delete pHyperlink;
533 delete pDInfoSec2;
535 if ( mbDocumentFound )
537 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
538 // HyperList lesen / Indexe der einzelnen Eintraege setzen
539 DffRecordHeader aHyperHd;
540 if ( SeekToRec( rStCtrl, PPT_PST_ExObjList, maDocHd.GetRecEndFilePos(), &aHyperHd ) )
542 UINT32 nExObjHyperListLen = aHyperHd.GetRecEndFilePos();
543 for ( void* pPtr = aHyperList.First(); pPtr; pPtr = aHyperList.Next() )
545 DffRecordHeader aHyperE;
546 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlink, nExObjHyperListLen, &aHyperE ) )
547 break;
548 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlinkAtom, nExObjHyperListLen, NULL, 0 ) )
549 break;
550 rStCtrl.SeekRel( 8 );
551 rStCtrl >> ((SdHyperlinkEntry*)pPtr)->nIndex;
552 aHyperE.SeekToEndOfRecord( rStCtrl );
557 Size aVisAreaSize;
558 switch ( aUserEditAtom.eLastViewType )
560 case 5 : // notes master
561 case 3 : // notes
562 aVisAreaSize = aDocAtom.GetNotesPageSize();
563 break;
564 default :
565 aVisAreaSize = aDocAtom.GetSlidesPageSize();
567 Scale( aVisAreaSize );
568 pDocShell->SetVisArea( Rectangle( Point(), aVisAreaSize ) );
570 ///////////////////////////////////////////////////////////
571 // create master pages:
572 ///////////////////////////////////////////////////////////
573 SfxProgress* pStbMgr = new SfxProgress( pDocShell, String( SdResId( STR_POWERPOINT_IMPORT ) ),
574 pMasterPages->Count() + pSlidePages->Count() + pNotePages->Count() );
576 UINT32 nImportedPages = 0;
578 UINT16 nMasterAnz = GetPageCount( PPT_MASTERPAGE );
580 for ( USHORT nMasterNum = 0; nMasterNum < nMasterAnz; nMasterNum++ )
582 SetPageNum( nMasterNum, PPT_MASTERPAGE );
583 SdPage* pPage = (SdPage*)MakeBlancPage( TRUE );
584 if ( pPage )
586 BOOL bNotesMaster = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bNotesMaster;
587 BOOL bStarDrawFiller = (*GetPageList( eAktPageKind ) )[ nAktPageNum ]->bStarDrawFiller;
589 PageKind ePgKind = ( bNotesMaster ) ? PK_NOTES : PK_STANDARD;
590 pPage->SetPageKind( ePgKind );
591 pSdrModel->InsertMasterPage( (SdrPage*)pPage );
592 if ( bNotesMaster && bStarDrawFiller )
593 ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_NOTES, TRUE );
594 if ( nMasterNum )
596 boost::optional< sal_Int16 > oStartNumbering;
597 SfxStyleSheet* pSheet;
598 if ( nMasterNum == 1 )
600 ///////////////////
601 // standardsheet //
602 ///////////////////
603 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
604 if ( pSheet )
606 SfxItemSet& rItemSet = pSheet->GetItemSet();
607 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
608 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
609 aParagraph.AppendPortion( aPortion );
610 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
611 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
615 // PSEUDO
616 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
617 if ( pSheet )
619 SfxItemSet& rItemSet = pSheet->GetItemSet();
620 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
621 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
622 aParagraph.AppendPortion( aPortion );
623 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
624 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
627 ///////////////////////////////////////////////////////////
628 // create layoutstylesheets, set layoutname and stylesheet
629 // (nur auf Standard- und Notizseiten)
630 ///////////////////////////////////////////////////////////
631 String aLayoutName( SdResId( STR_LAYOUT_DEFAULT_NAME ) );
632 if ( nMasterNum > 2 )
634 if ( ePgKind == PK_STANDARD )
635 { // Standardseite: Neues Praesentationslayout erzeugen
636 aLayoutName = String( SdResId( STR_LAYOUT_DEFAULT_TITLE_NAME ) );
637 aLayoutName += String::CreateFromInt32( (sal_Int32)( ( nMasterNum + 1 ) / 2 - 1 ) );
638 ( (SdStyleSheetPool*)mpDoc->GetStyleSheetPool() )->CreateLayoutStyleSheets( aLayoutName );
640 else // Notizseite: Praesentationslayout von der Standardseite verwenden
641 aLayoutName = ( (SdPage*)mpDoc->GetMasterPage( nMasterNum - 1 ) )->GetName();
643 pPage->SetName( aLayoutName );
644 aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
645 aLayoutName += String( SdResId( STR_LAYOUT_OUTLINE ) );
646 pPage->SetLayoutName( aLayoutName );
648 /////////////////////
649 // set stylesheets //
650 /////////////////////
651 if ( pPage->GetPageKind() == PK_STANDARD )
653 UINT32 nTitleInstance = TSS_TYPE_PAGETITLE;
654 UINT32 nOutlinerInstance = TSS_TYPE_BODY;
655 // BOOL bSwapStyleSheet = pSlideLayout->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE;
656 // if ( bSwapStyleSheet )
657 // {
658 // nTitleInstance = TSS_TYPE_TITLE;
659 // nOutlinerInstance = TSS_TYPE_SUBTITLE;
660 // }
661 /////////////////////
662 // titelstylesheet //
663 /////////////////////
664 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
665 if ( pSheet )
667 SfxItemSet& rItemSet = pSheet->GetItemSet();
668 PPTParagraphObj aParagraph( *pPPTStyleSheet, nTitleInstance, 0 );
669 PPTPortionObj aPortion( *pPPTStyleSheet, nTitleInstance, 0 );
670 aParagraph.AppendPortion( aPortion );
671 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
672 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
674 ////////////////////////
675 // outlinerstylesheet //
676 ////////////////////////
677 UINT16 nLevel;
678 PPTParagraphObj* pParagraphs[ 9 ];
679 PPTParagraphObj* pPreviousPara = NULL;
681 for ( nLevel = 0; nLevel < 9; nLevel++ )
683 String aName( pPage->GetLayoutName() );
684 aName.Append( (sal_Unicode)( ' ' ) );
685 aName.Append( String::CreateFromInt32( nLevel + 1 ) );
686 SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
687 DBG_ASSERT( pOutlineSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden" );
688 if ( pOutlineSheet )
690 pParagraphs[ nLevel ] = new PPTParagraphObj( *pPPTStyleSheet, nOutlinerInstance, nLevel );
691 SfxItemSet& rItemSet = pOutlineSheet->GetItemSet();
692 PPTPortionObj aPortion( *pPPTStyleSheet, nOutlinerInstance, nLevel );
693 pParagraphs[ nLevel ]->AppendPortion( aPortion );
694 pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, pPreviousPara );
695 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
696 pPreviousPara = pParagraphs[ nLevel ];
698 else
699 pParagraphs[ nLevel ] = NULL;
701 for ( nLevel = 0; nLevel < 9; delete pParagraphs[ nLevel++ ] ) ;
702 /////////////////////////
703 // subtitle stylesheet //
704 /////////////////////////
705 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
706 if ( pSheet )
708 SfxItemSet& rItemSet = pSheet->GetItemSet();
709 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
710 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
711 aParagraph.AppendPortion( aPortion );
712 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
713 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
716 else if ( ePgKind == PK_NOTES )
718 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
719 if ( pSheet )
721 SfxItemSet& rItemSet = pSheet->GetItemSet();
722 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
723 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
724 aParagraph.AppendPortion( aPortion );
725 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
726 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
733 SdPage* pMPage;
734 sal_uInt16 i;
735 for ( i = 1; i < mpDoc->GetMasterPageCount() && ( (pMPage = (SdPage*)mpDoc->GetMasterPage( i )) != 0 ); i++ )
737 SetPageNum( i, PPT_MASTERPAGE );
738 /////////////////////////////////////////////
739 // importing master page objects //
740 /////////////////////////////////////////////
741 PptSlidePersistList* pList = GetPageList( eAktPageKind );
742 PptSlidePersistEntry* pPersist = ( pList && ( nAktPageNum < pList->Count() ) )
743 ? (*pList)[ nAktPageNum ] : NULL;
744 if ( pPersist )
746 if ( pPersist->bStarDrawFiller && pPersist->bNotesMaster && ( nAktPageNum > 2 ) && ( ( nAktPageNum & 1 ) == 0 ) )
748 pSdrModel->DeleteMasterPage( nAktPageNum );
749 SdrPage* pNotesClone = ((SdPage*)pSdrModel->GetMasterPage( 2 ))->Clone();
750 pSdrModel->InsertMasterPage( pNotesClone, nAktPageNum );
751 if ( pNotesClone )
753 String aLayoutName( ((SdPage*)pSdrModel->GetMasterPage( nAktPageNum - 1 ))->GetLayoutName() );
754 ((SdPage*)pNotesClone)->SetPresentationLayout( aLayoutName, sal_False, sal_False, sal_False );
755 ((SdPage*)pNotesClone)->SetLayoutName( aLayoutName );
758 else if ( ( pPersist->bStarDrawFiller == FALSE ) )
760 PptSlidePersistEntry* pE = pPersist;
761 while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
763 sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
764 if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
765 break;
766 else
767 pE = (*pList)[ nNextMaster ];
769 SdrObject* pObj = ImportPageBackgroundObject( *pMPage, pE->nBackgroundOffset, TRUE ); // import background
770 if ( pObj )
771 pMPage->NbcInsertObject( pObj );
773 sal_Bool bNewAnimationsUsed = sal_False;
774 ProcessData aProcessData( *(*pList)[ nAktPageNum ], (SdPage*)pMPage );
775 sal_uInt32 nFPosMerk = rStCtrl.Tell();
776 DffRecordHeader aPageHd;
777 if ( SeekToAktPage( &aPageHd ) )
779 if ( mbTracing )
780 mpTracer->AddAttribute( rtl::OUString::createFromAscii( "MasterPage" ), rtl::OUString::valueOf( (sal_Int32) (nAktPageNum + 1) ) );
782 while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
784 DffRecordHeader aHd;
785 rStCtrl >> aHd;
786 switch( aHd.nRecType )
788 case PPT_PST_PPDrawing :
790 aHd.SeekToBegOfRecord( rStCtrl );
791 DffRecordHeader aPPDrawHd;
792 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
794 sal_uInt32 nPPDrawEnd = aPPDrawHd.GetRecEndFilePos();
795 DffRecordHeader aEscherF002Hd;
796 if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, nPPDrawEnd, &aEscherF002Hd ) )
798 sal_uInt32 nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
799 DffRecordHeader aEscherObjListHd;
800 if ( SeekToRec( rStCtrl, DFF_msofbtSpgrContainer, nEscherF002End, &aEscherObjListHd ) )
802 sal_uInt32 nObjCount = 0;
803 while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aEscherObjListHd.GetRecEndFilePos() ) )
805 DffRecordHeader aHd2;
806 rStCtrl >> aHd2;
807 if ( ( aHd2.nRecType == DFF_msofbtSpContainer ) || ( aHd2.nRecType == DFF_msofbtSpgrContainer ) )
809 if ( nObjCount++ ) // skipping the first object
811 Rectangle aEmpty;
812 aHd2.SeekToBegOfRecord( rStCtrl );
813 SdrObject* pImpObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
814 if ( pImpObj )
816 pImpObj->SetLayer( mnBackgroundObjectsLayerID );
817 pMPage->NbcInsertObject( pImpObj );
821 aHd2.SeekToEndOfRecord( rStCtrl );
827 break;
829 case PPT_PST_ProgTags :
831 DffRecordHeader aProgTagHd;
832 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
834 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
836 DffRecordHeader aProgTagContentHd;
837 rStCtrl >> aProgTagContentHd;
838 switch( aProgTagContentHd.nRecType )
840 case DFF_msofbtAnimGroup :
842 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pMPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
843 ppt::AnimationImporter aImporter( this, rStCtrl );
844 aImporter.import( xPage, aProgTagContentHd );
845 bNewAnimationsUsed = sal_True;
847 break;
849 aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
853 break;
855 aHd.SeekToEndOfRecord( rStCtrl );
857 if ( mbTracing )
858 mpTracer->RemoveAttribute( rtl::OUString::createFromAscii( "MasterPage" ) );
860 rStCtrl.Seek( nFPosMerk );
861 ImportPageEffect( (SdPage*)pMPage, bNewAnimationsUsed );
863 ///////////////////////
864 // background object //
865 ///////////////////////
866 pObj = pMPage->GetObj( 0 );
867 if ( pObj && pObj->GetObjIdentifier() == OBJ_RECT )
869 if ( pMPage->GetPageKind() == PK_STANDARD )
871 // Hintergrundobjekt gefunden (erstes Objekt der MasterPage)
872 pObj->SetEmptyPresObj( TRUE );
873 pObj->SetUserCall( pMPage );
874 pObj->SetLayer( mnBackgroundLayerID );
876 // Schatten am ersten Objekt (Hintergrundobjekt) entfernen (#57918#)
877 SfxItemSet aTempAttr( mpDoc->GetPool() );
878 aTempAttr.Put( pObj->GetMergedItemSet() );
880 BOOL bShadowIsOn = ( (SdrShadowItem&)( aTempAttr.Get( SDRATTR_SHADOW ) ) ).GetValue();
881 if( bShadowIsOn )
883 aTempAttr.Put( SdrShadowItem( FALSE ) );
884 pObj->SetMergedItemSet( aTempAttr );
886 SfxStyleSheet* pSheet = pMPage->GetStyleSheetForPresObj( PRESOBJ_BACKGROUND );
887 if ( pSheet )
888 { // StyleSheet fuellen und dem Objekt zuweisen
889 pSheet->GetItemSet().ClearItem();
890 pSheet->GetItemSet().Put( pObj->GetMergedItemSet() );
891 aTempAttr.ClearItem();
892 pObj->SetMergedItemSet( aTempAttr );
893 pObj->SetStyleSheet( pSheet, FALSE );
895 pMPage->InsertPresObj( pObj, PRESOBJ_BACKGROUND );
897 // #110094#-15
898 // tell the page that it's visualization has changed
899 pMPage->ActionChanged();
904 if( pStbMgr )
905 pStbMgr->SetState( nImportedPages++ );
907 ////////////////////////////////////
908 // importing slide pages //
909 ////////////////////////////////////
911 UINT32 nFPosMerk = rStCtrl.Tell();
912 PptPageKind ePageKind = eAktPageKind;
913 UINT16 nPageNum = nAktPageNum;
915 SdPage* pHandoutPage = (SdPage*)MakeBlancPage( FALSE );
916 pHandoutPage->SetPageKind( PK_HANDOUT );
917 pSdrModel->InsertPage( pHandoutPage );
919 USHORT nPageAnz = GetPageCount( PPT_SLIDEPAGE );
920 if ( nPageAnz )
922 for ( USHORT nPage = 0; nPage < nPageAnz; nPage++ )
924 sal_Bool bNewAnimationsUsed = sal_False;
926 mePresChange = PRESCHANGE_SEMIAUTO;
927 SetPageNum( nPage, PPT_SLIDEPAGE );
928 SdPage* pPage = (SdPage*)MakeBlancPage( FALSE );
929 PptSlidePersistEntry* pMasterPersist = NULL;
930 if ( HasMasterPage( nPage, PPT_SLIDEPAGE ) ) // try to get the LayoutName from the masterpage
932 sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
933 pPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nMasterNum));
934 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
935 if ( pPageList && nMasterNum < pPageList->Count() )
936 pMasterPersist = (*pPageList)[ nMasterNum ];
937 pPage->SetLayoutName(((SdPage&)pPage->TRG_GetMasterPage()).GetLayoutName());
939 pPage->SetPageKind( PK_STANDARD );
940 pSdrModel->InsertPage( pPage ); // SJ: #i29625# because of form controls, the
941 ImportPage( pPage, pMasterPersist ); // page must be inserted before importing
942 SetHeaderFooterPageSettings( pPage, pMasterPersist );
943 // CWS preseng01: pPage->SetPageKind( PK_STANDARD );
945 DffRecordHeader aPageHd;
946 if ( SeekToAktPage( &aPageHd ) )
948 aPageHd.SeekToContent( rStCtrl );
949 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
951 DffRecordHeader aHd;
952 rStCtrl >> aHd;
953 switch ( aHd.nRecType )
955 case PPT_PST_ProgTags :
957 DffRecordHeader aProgTagHd;
958 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
960 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
962 DffRecordHeader aProgTagContentHd;
963 rStCtrl >> aProgTagContentHd;
964 switch( aProgTagContentHd.nRecType )
967 case PPT_PST_CommentContainer :
971 break;
973 case DFF_msofbtAnimGroup :
975 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
976 ppt::AnimationImporter aImporter( this, rStCtrl );
977 aImporter.import( xPage, aProgTagContentHd );
978 bNewAnimationsUsed = sal_True;
980 break;
982 case PPT_PST_NewlyAddedAtomByXP11008 : // ???
983 break;
985 case PPT_PST_NewlyAddedAtomByXP12011 : // ??? don't know, this atom is always 8 bytes big
986 break; // and is appearing in nearly every l10 progtag
988 aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
992 break;
994 case PPT_PST_HeadersFooters :
995 case PPT_PST_PPDrawing :
996 default:
997 break;
1000 aHd.SeekToEndOfRecord( rStCtrl );
1002 ImportPageEffect( (SdPage*)pPage, bNewAnimationsUsed );
1005 // creating the corresponding note page
1006 eAktPageKind = PPT_NOTEPAGE;
1007 SdPage* pNotesPage = (SdPage*)MakeBlancPage( FALSE );
1008 sal_uInt16 nNotesMasterNum = GetMasterPageIndex( nPage, PPT_SLIDEPAGE ) + 1;
1009 sal_uInt32 nNotesPageId = GetNotesPageId( nPage );
1010 if ( nNotesPageId )
1012 nImportedPages++;
1013 sal_uInt16 nNotesPageIndex = pNotePages->FindPage( nNotesPageId );
1014 if ( nNotesPageIndex == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
1015 nNotesPageIndex = 0;
1016 SetPageNum( nNotesPageIndex, PPT_NOTEPAGE );
1017 PptSlidePersistEntry* pMasterPersist2 = NULL;
1018 if ( HasMasterPage( nNotesPageIndex, PPT_NOTEPAGE ) ) // try to get the LayoutName from the masterpage
1020 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1021 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
1022 if ( pPageList && nNotesMasterNum < pPageList->Count() )
1023 pMasterPersist2 = (*pPageList)[ nNotesMasterNum ];
1024 pNotesPage->SetLayoutName( ((SdPage&)pNotesPage->TRG_GetMasterPage()).GetLayoutName() );
1026 pNotesPage->SetPageKind( PK_NOTES );
1027 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1028 pSdrModel->InsertPage( pNotesPage ); // SJ: #i29625# because of form controls, the
1029 ImportPage( pNotesPage, pMasterPersist2 ); // page must be inserted before importing
1030 SetHeaderFooterPageSettings( pNotesPage, pMasterPersist2 );
1031 pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, FALSE );
1033 else
1035 pNotesPage->SetPageKind( PK_NOTES );
1036 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1037 pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, TRUE );
1038 pSdrModel->InsertPage( pNotesPage );
1039 SdrObject* pPageObj = pNotesPage->GetPresObj( PRESOBJ_PAGE, 1 );
1040 if ( pPageObj )
1041 ((SdrPageObj*)pPageObj)->SetReferencedPage(pSdrModel->GetPage(( nPage << 1 ) + 1));
1044 if( pStbMgr )
1045 pStbMgr->SetState( nImportedPages++ );
1047 //////////////
1049 else
1051 // Das kann bei Dokumentvorlagen vorkommen
1052 eAktPageKind = PPT_SLIDEPAGE;
1053 SdrPage* pPage = MakeBlancPage( FALSE );
1054 pSdrModel->InsertPage( pPage );
1056 // #i37397#, trying to set the title master for the first page
1057 sal_uInt16 nMaster, nMasterCount = pSdrModel->GetMasterPageCount();
1058 SdPage* pFoundMaster = NULL;
1059 for ( nMaster = 1; nMaster < nMasterCount; nMaster++ )
1061 SdPage* pMaster = static_cast<SdPage*>( pSdrModel->GetMasterPage( nMaster ) );
1062 if ( pMaster->GetPageKind() == PK_STANDARD )
1064 SetPageNum( nMaster, PPT_MASTERPAGE );
1065 if ( !pFoundMaster )
1066 pFoundMaster = pMaster;
1067 else if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
1068 pFoundMaster = pMaster;
1069 if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
1070 break;
1073 if ( pFoundMaster )
1075 ((SdPage*)pPage)->TRG_SetMasterPage( *((SdPage*)pFoundMaster) );
1076 ((SdPage*)pPage)->SetLayoutName( ((SdPage*)pFoundMaster)->GetLayoutName() );
1078 ((SdPage*)pPage)->SetAutoLayout( AUTOLAYOUT_TITLE, TRUE, TRUE );
1080 eAktPageKind = PPT_NOTEPAGE;
1081 SdrPage* pNPage = MakeBlancPage( FALSE );
1082 pSdrModel->InsertPage( pNPage );
1084 SetPageNum( nPageNum, ePageKind );
1085 rStCtrl.Seek( nFPosMerk );
1087 ///////////////////////////////////////////////////////////////////
1088 // Handzettel und Notiz-Seiten erzeugen //
1089 ///////////////////////////////////////////////////////////////////
1090 bOk = mpDoc->CreateMissingNotesAndHandoutPages();
1091 if ( bOk )
1093 for ( i = 0; i < mpDoc->GetSdPageCount( PK_STANDARD ); i++ )
1095 ////////////////////
1096 // set AutoLayout //
1097 ////////////////////
1098 SetPageNum( i, PPT_SLIDEPAGE );
1099 SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
1100 AutoLayout eAutoLayout = AUTOLAYOUT_NONE;
1101 const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
1102 if ( pSlideLayout )
1104 switch ( pSlideLayout->eLayout ) // Praesentationslayouts fuer Standard-Seiten
1106 case PPT_LAYOUT_TITLEANDBODYSLIDE :
1108 eAutoLayout = AUTOLAYOUT_ENUM;
1109 USHORT nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1110 switch ( nID1 )
1112 case PPT_PLACEHOLDER_BODY :
1113 eAutoLayout = AUTOLAYOUT_ENUM;
1114 break;
1115 case PPT_PLACEHOLDER_TABLE :
1116 eAutoLayout = AUTOLAYOUT_TAB;
1117 break;
1118 case PPT_PLACEHOLDER_ORGANISZATIONCHART :
1119 eAutoLayout = AUTOLAYOUT_ORG;
1120 break;
1121 case PPT_PLACEHOLDER_GRAPH :
1122 eAutoLayout = AUTOLAYOUT_CHART;
1123 break;
1124 case PPT_PLACEHOLDER_OBJECT :
1125 eAutoLayout = AUTOLAYOUT_OBJ;
1126 break;
1127 case PPT_PLACEHOLDER_VERTICALTEXTBODY :
1128 eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE;
1129 break;
1132 break;
1134 case PPT_LAYOUT_2COLUMNSANDTITLE :
1136 eAutoLayout = AUTOLAYOUT_2TEXT;
1137 USHORT nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1138 USHORT nID2 = pSlideLayout->aPlaceholderId[ 2 ];
1139 if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_GRAPH )
1140 eAutoLayout = AUTOLAYOUT_TEXTCHART;
1141 else if ( nID1 == PPT_PLACEHOLDER_GRAPH && nID2 == PPT_PLACEHOLDER_BODY )
1142 eAutoLayout = AUTOLAYOUT_CHARTTEXT;
1143 else if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_CLIPART )
1144 eAutoLayout = AUTOLAYOUT_TEXTCLIP;
1145 else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_BODY )
1146 eAutoLayout = AUTOLAYOUT_CLIPTEXT;
1147 else if ( nID1 == PPT_PLACEHOLDER_CLIPART && nID2 == PPT_PLACEHOLDER_VERTICALTEXTBODY )
1148 eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART;
1149 else if ( ( nID1 == PPT_PLACEHOLDER_BODY )
1150 && ( ( nID2 == PPT_PLACEHOLDER_OBJECT ) || ( nID2 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
1151 eAutoLayout = AUTOLAYOUT_TEXTOBJ;
1152 else if ( ( nID2 == PPT_PLACEHOLDER_BODY )
1153 && ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) || ( nID1 == PPT_PLACEHOLDER_MEDIACLIP ) ) )
1154 eAutoLayout = AUTOLAYOUT_OBJTEXT;
1155 else if ( ( nID1 == PPT_PLACEHOLDER_OBJECT ) && ( nID2 == PPT_PLACEHOLDER_OBJECT ) )
1156 eAutoLayout = AUTOLAYOUT_OBJ;
1158 break;
1160 case PPT_LAYOUT_2ROWSANDTITLE :
1162 eAutoLayout = AUTOLAYOUT_2TEXT;
1163 USHORT nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1164 USHORT nID2 = pSlideLayout->aPlaceholderId[ 2 ];
1165 if ( nID1 == PPT_PLACEHOLDER_BODY && nID2 == PPT_PLACEHOLDER_OBJECT )
1166 eAutoLayout = AUTOLAYOUT_TEXTOVEROBJ;
1167 else if ( nID1 == PPT_PLACEHOLDER_OBJECT && nID2 == PPT_PLACEHOLDER_BODY )
1168 eAutoLayout = AUTOLAYOUT_OBJOVERTEXT;
1170 break;
1172 case PPT_LAYOUT_TITLESLIDE :
1173 eAutoLayout = AUTOLAYOUT_TITLE;
1174 break;
1175 case PPT_LAYOUT_ONLYTITLE :
1176 eAutoLayout = AUTOLAYOUT_ONLY_TITLE;
1177 break;
1178 case PPT_LAYOUT_RIGHTCOLUMN2ROWS :
1179 eAutoLayout = AUTOLAYOUT_TEXT2OBJ;
1180 break;
1181 case PPT_LAYOUT_LEFTCOLUMN2ROWS :
1182 eAutoLayout = AUTOLAYOUT_2OBJTEXT;
1183 break;
1184 case PPT_LAYOUT_TOPROW2COLUMN :
1185 eAutoLayout = AUTOLAYOUT_2OBJOVERTEXT;
1186 break;
1187 case PPT_LAYOUT_4OBJECTS :
1188 eAutoLayout = AUTOLAYOUT_4OBJ;
1189 break;
1190 case PPT_LAYOUT_BIGOBJECT :
1191 eAutoLayout = AUTOLAYOUT_OBJ;
1192 break;
1193 case PPT_LAYOUT_TITLERIGHTBODYLEFT :
1194 eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE; // AUTOLAYOUT_ENUM;
1195 break;
1196 case PPT_LAYOUT_TITLERIGHT2BODIESLEFT :
1197 eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART; // AUTOLAYOUT_TEXT2OBJ;
1198 break;
1200 case PPT_LAYOUT_BOTTOMROW2COLUMNS :
1201 case PPT_LAYOUT_BLANCSLIDE :
1202 case PPT_LAYOUT_MASTERSLIDE : // Layout der Standard- und Titel-MasterPage
1203 case PPT_LAYOUT_TITLEMASTERSLIDE :
1204 case PPT_LAYOUT_MASTERNOTES : // Layout der Notizen-MasterPage
1205 case PPT_LAYOUT_NOTESTITLEBODY : // Praesentationslayout fuer Notiz-Seiten
1206 case PPT_LAYOUT_HANDOUTLAYOUT : // Praesentationslayout fuer Handzettelseiten
1207 eAutoLayout = AUTOLAYOUT_NONE;
1208 break;
1210 if ( eAutoLayout != AUTOLAYOUT_NONE )
1211 pPage->SetAutoLayout( eAutoLayout, FALSE );
1214 //////////////////////////////////////////////////////////////
1215 // Handzettel-MasterPage: Autolayout setzen //
1216 //////////////////////////////////////////////////////////////
1217 SdPage* pHandoutMPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
1218 pHandoutMPage->SetAutoLayout( AUTOLAYOUT_HANDOUT6, TRUE, TRUE );
1221 UINT32 nSlideCount = GetPageCount();
1222 for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.Count() ); i++ )
1224 SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
1225 String* pName = (String*)maSlideNameList.GetObject( i );
1226 if ( pPage && pName )
1228 if ( pName->Len() )
1229 pPage->SetName( *pName );
1230 else
1231 *pName = pPage->GetName();
1234 if ( mbDocumentFound )
1236 mpDoc->SetSummationOfParagraphs( sal_True );
1237 if ( pDocShell )
1239 ::sd::FrameView* pFrameView = mpDoc->GetFrameView( 0 );
1240 if ( !pFrameView )
1242 List* pFrameViewList = mpDoc->GetFrameViewList();
1243 if ( pFrameViewList )
1245 pFrameView = new ::sd::FrameView( mpDoc );
1246 if ( pFrameView )
1247 pFrameViewList->Insert( pFrameView );
1250 if ( pFrameView )
1252 sal_uInt16 nSelectedPage = 0;
1253 PageKind ePageKind = PK_STANDARD;
1254 EditMode eEditMode = EM_PAGE;
1256 switch ( aUserEditAtom.eLastViewType )
1258 case 7 : // outliner view
1260 SfxItemSet* pSet = mrMed.GetItemSet();
1261 if ( pSet )
1262 pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
1264 break;
1265 case 8 : // slide sorter
1267 SfxItemSet* pSet = mrMed.GetItemSet();
1268 if ( pSet )
1269 pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
1271 break;
1272 case 10 : // titlemaster
1273 nSelectedPage = 1;
1274 case 2 : // master
1276 ePageKind = PK_STANDARD;
1277 eEditMode = EM_MASTERPAGE;
1279 break;
1280 case 5 : // notes master
1281 eEditMode = EM_MASTERPAGE;
1282 case 3 : // notes
1283 ePageKind = PK_NOTES;
1284 break;
1285 case 4 : // handout
1286 ePageKind = PK_HANDOUT;
1287 break;
1288 default :
1289 case 1 : // normal
1290 break;
1292 pFrameView->SetPageKind( ePageKind );
1293 pFrameView->SetSelectedPage( nSelectedPage );
1294 pFrameView->SetViewShEditMode( eEditMode, ePageKind );
1297 DffRecordHeader aCustomShowHeader;
1298 // custom show einlesen und setzen
1299 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
1300 if ( SeekToRec( rStCtrl, PPT_PST_NamedShows, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
1302 DffRecordHeader aCuHeader;
1303 while( SeekToRec( rStCtrl, PPT_PST_NamedShow, aCustomShowHeader.GetRecEndFilePos(), &aCuHeader ) )
1305 DffRecordHeader aContent;
1306 if ( SeekToRec( rStCtrl, PPT_PST_CString, aCuHeader.GetRecEndFilePos(), &aContent ) )
1308 String aCuShow;
1309 aContent.SeekToBegOfRecord( rStCtrl );
1310 if ( ReadString( aCuShow ) )
1312 if ( SeekToRec( rStCtrl, PPT_PST_NamedShowSlides, aCuHeader.GetRecEndFilePos(), &aContent ) )
1314 PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
1315 UINT32 nSCount = aContent.nRecLen >> 2;
1316 if ( pPageList && nSCount )
1318 List* pList = mpDoc->GetCustomShowList( TRUE );
1319 if ( pList )
1321 SdCustomShow* pSdCustomShow = new SdCustomShow( mpDoc );
1322 if ( pSdCustomShow )
1324 pSdCustomShow->SetName( aCuShow );
1325 UINT32 nFound = 0;
1326 for ( UINT32 nS = 0; nS < nSCount; nS++ )
1328 UINT32 nPageNumber;
1329 rStCtrl >> nPageNumber;
1330 USHORT nPage = pPageList->FindPage( nPageNumber );
1331 if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
1333 SdPage* pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
1334 if ( pPage )
1336 pSdCustomShow->Insert( pPage, LIST_APPEND );
1337 nFound++;
1341 if ( nFound )
1342 pList->Insert( pSdCustomShow, LIST_APPEND );
1343 else
1344 delete pSdCustomShow;
1353 // this is defaulted, maybe there is no SSDocInfoAtom
1354 String aCustomShow;
1355 sal_uInt32 nFlags = 1; // Bit 0: Auto advance
1356 sal_uInt32 nPenColor = 0x1000000;
1357 sal_Int32 nRestartTime = 0x7fffffff;
1358 sal_uInt16 nStartSlide = 0;
1359 sal_Int16 nEndSlide = 0;
1361 // read the pres. configuration
1362 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
1363 if ( SeekToRec( rStCtrl, PPT_PST_SSDocInfoAtom, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
1365 rStCtrl >> nPenColor
1366 >> nRestartTime
1367 >> nStartSlide
1368 >> nEndSlide;
1370 sal_Unicode nChar;
1371 for ( UINT32 i2 = 0; i2 < 32; i2++ )
1373 rStCtrl >> nChar;
1374 if ( nChar )
1375 aCustomShow.Append( nChar );
1376 else
1378 rStCtrl.SeekRel( ( 31 - i2 ) << 1 );
1379 break;
1382 rStCtrl >> nFlags;
1384 // set the current custom show
1385 if ( aCustomShow.Len() )
1387 void* pPtr;
1388 List* pList = mpDoc->GetCustomShowList( FALSE );
1389 if ( pList )
1391 for ( pPtr = pList->First(); pPtr; pPtr = pList->Next() )
1393 if ( ((SdCustomShow*)pPtr)->GetName() == aCustomShow )
1394 break;
1396 if ( !pPtr )
1397 pList->First();
1400 sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
1402 rPresSettings.mbManual = ( nFlags & 1 ) == 0;
1403 rPresSettings.mbAnimationAllowed = ( nFlags & 2 ) == 0;
1404 rPresSettings.mbAll = ( nFlags & 4 ) == 0;
1405 rPresSettings.mbCustomShow = ( nFlags & 8 ) != 0;
1406 rPresSettings.mbEndless = ( nFlags & 0x80 ) != 0;
1407 rPresSettings.mbFullScreen = ( nFlags & 0x10 ) == 0;
1408 // rPresSettings.mnPauseTimeout;
1409 // rPresSettings.mbShowLogo;
1410 if ( nStartSlide && ( nStartSlide <= GetPageCount() ) )
1412 SdPage* pPage = mpDoc->GetSdPage( nStartSlide - 1, PK_STANDARD );
1413 if ( pPage )
1414 rPresSettings.maPresPage = pPage->GetName();
1418 delete pStbMgr;
1420 // read DocumentInfo
1421 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1422 mpDoc->GetObjectShell()->GetModel(), uno::UNO_QUERY_THROW);
1423 uno::Reference<document::XDocumentProperties> xDocProps
1424 = xDPS->getDocumentProperties();
1425 sfx2::LoadOlePropertySet(xDocProps, &mrStorage);
1426 xDocProps->setTemplateName(::rtl::OUString());
1428 pSdrModel->setLock( sal_False );
1429 return bOk;
1432 void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist )
1434 sal_uInt32 i;
1435 PptSlidePersistList* pList = GetPageList( eAktPageKind );
1436 if ( ( !pList ) || ( pList->Count() <= nAktPageNum ) )
1437 return;
1438 PptSlidePersistEntry& rSlidePersist = *(*pList)[ nAktPageNum ];
1439 HeaderFooterEntry* pHFE = rSlidePersist.pHeaderFooterEntry;
1440 if ( pHFE )
1442 for ( i = 0; i < 4; i++ )
1444 bool bVisible = pHFE->IsToDisplay( i );
1445 if ( ( eAktPageKind == PPT_SLIDEPAGE )
1446 && ( rSlidePersist.aSlideAtom.aLayout.eLayout == PPT_LAYOUT_TITLESLIDE )
1447 && ( aDocAtom.bTitlePlaceholdersOmitted == TRUE ) )
1449 bVisible = sal_False;
1451 if ( bVisible && pMasterPersist )
1453 sal_uInt32 nPosition = pHFE->NeedToImportInstance( i, rSlidePersist );
1454 if ( nPosition )
1456 Rectangle aEmpty;
1457 bVisible = sal_False;
1458 rStCtrl.Seek( nPosition );
1459 ProcessData aProcessData( rSlidePersist, (SdPage*)pPage );
1460 SdrObject* pObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
1461 if ( pObj )
1462 pPage->NbcInsertObject( pObj, 0 );
1465 String aPlaceHolderString;
1466 if ( pHFE->pPlaceholder )
1467 aPlaceHolderString = pHFE->pPlaceholder[ i ];
1469 sd::HeaderFooterSettings rHeaderFooterSettings( pPage->getHeaderFooterSettings() );
1470 switch( i )
1472 case 0 :
1474 rHeaderFooterSettings.mbDateTimeVisible = bVisible;
1475 rHeaderFooterSettings.mbDateTimeIsFixed = ( pHFE->nAtom & 0x20000 ) == 0;
1476 rHeaderFooterSettings.maDateTimeText = aPlaceHolderString;
1477 SvxDateFormat eDateFormat;
1478 SvxTimeFormat eTimeFormat;
1479 PPTFieldEntry::GetDateTime( pHFE->nAtom & 0xff, eDateFormat, eTimeFormat );
1480 rHeaderFooterSettings.meDateTimeFormat = eDateFormat | ( eTimeFormat << 4 );
1482 break;
1483 case 1 :
1485 rHeaderFooterSettings.mbHeaderVisible = bVisible;
1486 rHeaderFooterSettings.maHeaderText = aPlaceHolderString;
1488 break;
1489 case 2 :
1491 rHeaderFooterSettings.mbFooterVisible = bVisible;
1492 rHeaderFooterSettings.maFooterText = aPlaceHolderString;
1494 break;
1495 case 3 :
1497 rHeaderFooterSettings.mbSlideNumberVisible = bVisible;
1499 break;
1501 pPage->setHeaderFooterSettings( rHeaderFooterSettings );
1506 //////////////////////////////////////////////////////////////////////////
1508 // Import von Seiten
1510 //////////////////////////////////////////////////////////////////////////
1512 struct Ppt97AnimationStlSortHelper
1514 bool operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 );
1517 bool Ppt97AnimationStlSortHelper::operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 )
1519 if( !p1.second.get() || !p2.second.get() )
1520 return true;
1521 if( *p1.second < *p2.second )
1522 return true;
1523 if( *p1.second > *p2.second )
1524 return false;
1525 if( p1.first->GetOrdNum() < p2.first->GetOrdNum() )
1526 return true;
1527 return false;
1530 void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimationsUsed )
1532 ULONG nFilePosMerk = rStCtrl.Tell();
1534 // PageKind an der Seite setzen (bisher nur PK_STANDARD oder PK_NOTES)
1535 if ( pPage->GetPageKind() == PK_STANDARD )
1537 PptSlidePersistList* pPersistList = GetPageList( eAktPageKind );
1538 PptSlidePersistEntry* pActualSlidePersist = ( pPersistList && ( nAktPageNum < pPersistList->Count() ) )
1539 ? (*pPersistList)[ nAktPageNum ] : NULL;
1541 if ( pActualSlidePersist && ( eAktPageKind == PPT_SLIDEPAGE ) )
1543 if ( ! ( pActualSlidePersist->aSlideAtom.nFlags & 1 ) ) // do not follow master objects ?
1545 if(pPage->TRG_HasMasterPage())
1547 SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1548 aVisibleLayers.Set(mnBackgroundObjectsLayerID, FALSE);
1549 pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
1553 DffRecordHeader aPageRecHd;
1554 if ( pPage && SeekToAktPage( &aPageRecHd ) )
1556 ULONG nPageRecEnd = aPageRecHd.GetRecEndFilePos();
1558 BOOL bTryTwice = ( eAktPageKind == PPT_SLIDEPAGE );
1559 BOOL bSSSlideInfoAtom = FALSE;
1560 while ( TRUE )
1562 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nPageRecEnd ) )
1564 DffRecordHeader aHd;
1565 rStCtrl >> aHd;
1566 switch ( aHd.nRecType )
1568 case PPT_PST_SSSlideInfoAtom:
1570 bSSSlideInfoAtom = TRUE;
1571 if ( eAktPageKind == PPT_MASTERPAGE )
1573 if ( pActualSlidePersist )
1574 pActualSlidePersist->aPersistAtom.nReserved = aHd.GetRecBegFilePos();
1576 else
1578 sal_Int8 nDirection, nTransitionType, nByteDummy, nSpeed;
1579 sal_Int16 nBuildFlags;
1580 sal_Int32 nSlideTime, nSoundRef;
1581 rStCtrl >> nSlideTime // Standzeit (in Ticks)
1582 >> nSoundRef // Index in SoundCollection
1583 >> nDirection // Richtung des Ueberblendeffekts
1584 >> nTransitionType // Ueberblendeffekt
1585 >> nBuildFlags // Buildflags (s.u.)
1586 >> nSpeed // Geschwindigkeit (langsam, mittel, schnell)
1587 >> nByteDummy >> nByteDummy >> nByteDummy;
1589 switch ( nTransitionType )
1591 case PPT_TRANSITION_TYPE_BLINDS :
1593 if ( nDirection == 0 )
1594 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES );// Vertikal blenden
1595 else if ( nDirection == 1 )
1596 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES );// Horizontal blenden
1598 break;
1599 case PPT_TRANSITION_TYPE_CHECKER :
1601 if ( nDirection == 0 )
1602 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD );// Vertikal versetzt einblenden ??
1603 else if ( nDirection == 1 )
1604 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD );// Horizontal versetzt einblenden ??
1606 break;
1607 case PPT_TRANSITION_TYPE_COVER :
1609 if ( nDirection == 0 )
1610 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT ); // Von rechts ueberdecken
1611 else if ( nDirection == 1 )
1612 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM ); // Von unten ueberdecken
1613 else if ( nDirection == 2 )
1614 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT ); // Von links ueberdecken
1615 else if ( nDirection == 3 )
1616 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP ); // Von oben ueberdecken
1617 else if ( nDirection == 4 )
1618 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT );// Von rechts unten ueberdecken ??
1619 else if ( nDirection == 5 )
1620 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT ); // Von links unten ueberdecken ??
1621 else if ( nDirection == 6 )
1622 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT );// Von rechts oben ueberdecken
1623 else if ( nDirection == 7 )
1624 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT ); // Von links oben ueberdecken ??
1626 break;
1627 case PPT_TRANSITION_TYPE_NONE :
1629 if ( nBuildFlags )
1631 if ( nDirection == 0 )
1632 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_NONE ); // Direkt
1633 else if ( nDirection == 1 )
1635 pPage->setTransitionType( animations::TransitionType::BARWIPE );
1636 pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
1637 pPage->setTransitionFadeColor( 0 );
1640 else
1641 pPage->setTransitionType( 0 );
1643 break;
1644 case PPT_TRANSITION_TYPE_DISSOLVE :
1645 pPage->SetFadeEffect(::com::sun::star::presentation::FadeEffect_DISSOLVE); // Aufloesen
1646 break;
1647 case PPT_TRANSITION_TYPE_RANDOM_BARS :
1649 if ( nDirection == 0 )
1650 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES ); // Horizontale Linien
1651 else if ( nDirection == 1 )
1652 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES ); // Vertikale Linien
1654 break;
1655 case PPT_TRANSITION_TYPE_SPLIT :
1657 if ( nDirection == 0 )
1658 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL ); // Horizontal oeffnen
1659 else if ( nDirection == 1 )
1660 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL ); // Horizontal schliessen
1661 else if ( nDirection == 2 )
1662 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL ); // Vertikal oeffnen
1663 else if ( nDirection == 3 )
1664 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL );// Vertikal schliessen
1666 break;
1667 case PPT_TRANSITION_TYPE_STRIPS :
1669 if ( nDirection == 4 )
1670 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT );// Diagonal nach links oben
1671 else if ( nDirection == 5 )
1672 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT ); // Diagonal nach rechts oben
1673 else if ( nDirection == 6 )
1674 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT );// Diagonal nach links unten
1675 else if ( nDirection == 7 )
1676 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT ); // Diagonal nach rechts unten
1678 break;
1679 case PPT_TRANSITION_TYPE_PULL :
1681 if ( nDirection == 0 )
1682 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT ); // Nach links aufdecken
1683 else if ( nDirection == 1 )
1684 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP ); // Nach oben aufdecken
1685 else if ( nDirection == 2 )
1686 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT ); // Nach rechts aufdecken
1687 else if ( nDirection == 3 )
1688 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM ); // Nach unten aufdecken
1689 else if ( nDirection == 4 )
1690 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT );// Nach links oben aufdecken
1691 else if ( nDirection == 5 )
1692 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT );// Nach rechts oben aufdecken
1693 else if ( nDirection == 6 )
1694 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT );// Nach links unten aufdecken
1695 else if ( nDirection == 7 )
1696 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT );// Nach rechts unten aufdecken
1698 break;
1699 case PPT_TRANSITION_TYPE_WIPE :
1701 if ( nDirection == 0 )
1702 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT ); // Von rechts rollen
1703 else if ( nDirection == 1 )
1704 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM );// Von unten rollen
1705 else if ( nDirection == 2 )
1706 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT ); // Von links rollen
1707 else if ( nDirection == 3 )
1708 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP ); // Von oben rollen
1710 break;
1711 case PPT_TRANSITION_TYPE_RANDOM :
1712 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_RANDOM ); // Automatisch
1713 break;
1714 case PPT_TRANSITION_TYPE_FADE :
1716 pPage->setTransitionType( animations::TransitionType::FADE );
1717 pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
1718 pPage->setTransitionFadeColor( 0 );
1720 break;
1721 case PPT_TRANSITION_TYPE_ZOOM :
1723 if ( nDirection == 0 )
1724 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER );// Von innen einblenden
1725 else if ( nDirection == 1 )
1726 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER ); // Von aussen einblenden
1728 break;
1729 case PPT_TRANSITION_TYPE_DIAMOND :
1731 pPage->setTransitionType( animations::TransitionType::IRISWIPE );
1732 pPage->setTransitionSubtype( animations::TransitionSubType::DIAMOND );
1734 break;
1735 case PPT_TRANSITION_TYPE_PLUS :
1737 pPage->setTransitionType( animations::TransitionType::FOURBOXWIPE );
1738 pPage->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT );
1740 break;
1741 case PPT_TRANSITION_TYPE_CIRCLE :
1743 pPage->setTransitionType( animations::TransitionType::ELLIPSEWIPE );
1744 pPage->setTransitionSubtype( animations::TransitionSubType::CIRCLE );
1746 break;
1747 case PPT_TRANSITION_TYPE_WEDGE :
1749 pPage->setTransitionType( animations::TransitionType::FANWIPE );
1750 pPage->setTransitionSubtype( animations::TransitionSubType::CENTERTOP );
1752 break;
1753 case PPT_TRANSITION_TYPE_WHEEL :
1755 pPage->setTransitionType( animations::TransitionType::PINWHEELWIPE );
1756 sal_Int16 nSubType;
1757 switch( nDirection )
1759 default:
1760 case 1 : nSubType = animations::TransitionSubType::ONEBLADE; break;
1761 case 2 : nSubType = animations::TransitionSubType::TWOBLADEVERTICAL; break;
1762 case 3 : nSubType = animations::TransitionSubType::THREEBLADE; break;
1763 case 4 : nSubType = animations::TransitionSubType::FOURBLADE; break;
1764 case 8 : nSubType = animations::TransitionSubType::EIGHTBLADE; break;
1766 pPage->setTransitionSubtype( nSubType );
1768 break;
1769 case PPT_TRANSITION_TYPE_PUSH :
1771 pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
1772 sal_Int16 nSubType;
1773 switch( nDirection )
1775 default:
1776 case 0 : nSubType = animations::TransitionSubType::FROMRIGHT; break;
1777 case 1 : nSubType = animations::TransitionSubType::FROMBOTTOM; break;
1778 case 2 : nSubType = animations::TransitionSubType::FROMLEFT; break;
1779 case 3 : nSubType = animations::TransitionSubType::FROMTOP; break;
1781 pPage->setTransitionSubtype( nSubType );
1783 break;
1784 case PPT_TRANSITION_TYPE_COMB :
1786 pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
1787 pPage->setTransitionSubtype( nDirection ? animations::TransitionSubType::COMBVERTICAL : animations::TransitionSubType::COMBHORIZONTAL );
1789 break;
1790 case PPT_TRANSITION_TYPE_NEWSFLASH :
1792 pPage->setTransitionType( animations::TransitionType::ZOOM );
1793 pPage->setTransitionSubtype( animations::TransitionSubType::ROTATEIN );
1795 break;
1796 case PPT_TRANSITION_TYPE_SMOOTHFADE :
1798 pPage->setTransitionType( animations::TransitionType::FADE );
1799 pPage->setTransitionSubtype( animations::TransitionSubType::CROSSFADE );
1801 break;
1804 if ( nSpeed == 0 )
1805 pPage->setTransitionDuration( 3.0 ); // langsam
1806 else if ( nSpeed == 1 )
1807 pPage->setTransitionDuration( 2.0 ); // mittel
1808 else if ( nSpeed == 2 )
1809 pPage->setTransitionDuration( 1.0 ); // schnell
1811 if ( nBuildFlags & 0x400 ) // slidechange by time
1812 { // Standzeit (in Ticks)
1813 pPage->SetPresChange( PRESCHANGE_AUTO );
1814 pPage->SetTime( nSlideTime / 1000 );
1816 else
1817 pPage->SetPresChange( mePresChange );
1819 // if ( nBuildFlags & 1 ) // slidechange by mouseclick
1820 // pPage->SetPresChange( mePresChange );
1822 if ( nBuildFlags & 4 )
1823 pPage->SetExcluded( TRUE ); // Dia nicht anzeigen
1824 if ( nBuildFlags & 16 )
1825 { // Dia mit Soundeffekt
1826 pPage->SetSound( TRUE );
1827 String aSoundFile( ReadSound( nSoundRef ) );
1828 pPage->SetSoundFile( aSoundFile );
1830 if ( nBuildFlags & ( 1 << 6 ) ) // Loop until next sound
1831 pPage->SetLoopSound( sal_True );
1832 if ( nBuildFlags & ( 1 << 8 ) ) // Stop the previous sound
1833 pPage->SetStopSound( sal_True );
1834 break;
1838 aHd.SeekToEndOfRecord( rStCtrl );
1840 if ( bTryTwice && ( bSSSlideInfoAtom == FALSE ) )
1842 bTryTwice = FALSE;
1843 if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
1845 USHORT nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
1846 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
1847 if ( pPageList && ( nMasterNum < pPageList->Count() ) )
1849 PptSlidePersistEntry* pE = (*pPageList)[ nMasterNum ];
1850 if ( pE )
1852 UINT32 nOfs = pE->aPersistAtom.nReserved;
1853 if ( nOfs )
1855 rStCtrl.Seek( nOfs );
1856 nPageRecEnd = nOfs + 16;
1857 continue;
1864 break;
1869 if ( !bNewAnimationsUsed )
1871 tAnimationVector aAnimationsOnThisPage;
1873 // add effects from page in correct order
1874 SdrObjListIter aSdrIter( *pPage, IM_FLAT );
1875 while ( aSdrIter.IsMore() )
1877 SdrObject* pObj = aSdrIter.Next();
1878 tAnimationMap::iterator aFound = maAnimations.find( pObj );
1879 if( aFound != maAnimations.end() )
1881 std::pair< SdrObject*, Ppt97AnimationPtr > aPair( (*aFound).first, (*aFound).second );
1882 aAnimationsOnThisPage.push_back( aPair );
1886 Ppt97AnimationStlSortHelper aSortHelper;
1887 std::sort( aAnimationsOnThisPage.begin(), aAnimationsOnThisPage.end(), aSortHelper );
1889 tAnimationVector::iterator aIter( aAnimationsOnThisPage.begin() );
1890 const tAnimationVector::iterator aEnd( aAnimationsOnThisPage.end() );
1892 for( ;aIter != aEnd; aIter++ )
1894 Ppt97AnimationPtr pPpt97Animation = (*aIter).second;;
1895 if( pPpt97Animation.get() )
1896 pPpt97Animation->createAndSetCustomAnimationEffect( (*aIter).first );
1899 rStCtrl.Seek( nFilePosMerk );
1902 //////////////////////////////////////////////////////////////////////////
1904 // Import von Sounds
1906 // Die Sounds werden nicht nur als String importiert sondern auch
1907 // in die Gallery einefuegt, falls dort noch nicht vorhanden.
1909 ///////////////////////////////////////////////////////////////////////////
1911 String ImplSdPPTImport::ReadSound(UINT32 nSoundRef) const
1913 String aRetval;
1914 UINT32 nPosMerk = rStCtrl.Tell();
1915 DffRecordHeader aDocHd;
1916 if ( SeekToDocument( &aDocHd ) )
1918 UINT32 nSoundLen = aDocHd.GetRecEndFilePos();
1919 DffRecordHeader aSoundBlockRecHd;
1920 if( SeekToRec( rStCtrl, PPT_PST_SoundCollection, nSoundLen, &aSoundBlockRecHd ) )
1922 UINT32 nDataLen = aSoundBlockRecHd.GetRecEndFilePos();
1923 DffRecordHeader aSoundRecHd;
1924 BOOL bRefStrValid = FALSE;
1925 BOOL bDone = FALSE;
1927 while( !bDone && SeekToRec( rStCtrl, PPT_PST_Sound, nDataLen, &aSoundRecHd ) )
1929 UINT32 nStrLen = aSoundRecHd.GetRecEndFilePos();
1930 String aRefStr;
1931 UINT32 nPosMerk2 = rStCtrl.Tell();
1932 if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 2 ) )
1934 if ( ReadString( aRefStr ) )
1935 bRefStrValid = TRUE;
1937 if ( bRefStrValid )
1939 if ( UniString::CreateFromInt32( nSoundRef ) == aRefStr )
1941 rStCtrl.Seek( nPosMerk2 );
1942 if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 0 ) )
1944 ReadString( aRetval );
1945 bDone = TRUE;
1949 if ( bDone )
1951 // ueberpruefen, ob diese Sound-Datei schon
1952 // existiert. Wenn nicht, exportiere diese
1953 // in unser lokales Sound-Verzeichnis.
1954 BOOL bSoundExists = FALSE;
1955 List* pSoundList = new List();
1957 GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, *pSoundList );
1958 GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, *pSoundList );
1960 for( ULONG n = 0; ( n < pSoundList->Count() ) && !bSoundExists; n++ )
1962 INetURLObject aURL( *(String*)pSoundList->GetObject( n ) );
1963 String aSoundName( aURL.GetName() );
1965 if( aSoundName == aRetval )
1967 aRetval = *(String*)pSoundList->GetObject( n );
1968 bSoundExists = TRUE;
1972 for ( void* pPtr = pSoundList->First(); pPtr; pPtr = pSoundList->Next() )
1973 delete (String*)pPtr;
1975 delete pSoundList;
1977 if ( !bSoundExists )
1979 rStCtrl.Seek( nPosMerk2 );
1980 DffRecordHeader aSoundDataRecHd;
1981 if ( SeekToRec( rStCtrl, PPT_PST_SoundData, nStrLen, &aSoundDataRecHd, 0 ) )
1983 String aGalleryDir( SvtPathOptions().GetGalleryPath() );
1984 INetURLObject aGalleryUserSound( aGalleryDir.GetToken( aGalleryDir.GetTokenCount( ';' ) - 1 ) );
1986 aGalleryUserSound.Append( aRetval );
1987 UINT32 nSoundDataLen = aSoundDataRecHd.nRecLen;
1988 UINT8* pBuf = new UINT8[ nSoundDataLen ];
1990 rStCtrl.Read( pBuf, nSoundDataLen );
1991 SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
1993 if( pOStm )
1995 pOStm->Write( pBuf, nSoundDataLen );
1997 if( pOStm->GetError() == ERRCODE_NONE )
1999 GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ) );
2000 aRetval = aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE );
2003 delete pOStm;
2006 delete[] pBuf;
2010 if ( !bDone )
2011 aSoundRecHd.SeekToEndOfRecord( rStCtrl );
2015 rStCtrl.Seek( nPosMerk );
2016 return aRetval;
2019 //////////////////////////////////////////////////////////////////////////
2021 // media object import, the return value is the url to the media object
2023 //////////////////////////////////////////////////////////////////////////
2025 String ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
2027 String aRetVal;
2028 DffRecordHeader* pHd( const_cast<ImplSdPPTImport*>(this)->aDocRecManager.GetRecordHeader( PPT_PST_ExObjList, SEEK_FROM_BEGINNING ) );
2029 if ( pHd )
2031 pHd->SeekToContent( rStCtrl );
2032 while ( ( rStCtrl.Tell() < pHd->GetRecEndFilePos() ) && !aRetVal.Len() )
2034 DffRecordHeader aHdMovie;
2035 rStCtrl >> aHdMovie;
2036 switch( aHdMovie.nRecType )
2038 case PPT_PST_ExAviMovie :
2039 case PPT_PST_ExMCIMovie :
2041 DffRecordHeader aExVideoHd;
2042 if ( SeekToRec( rStCtrl, PPT_PST_ExVideo, aHdMovie.GetRecEndFilePos(), &aExVideoHd ) )
2044 DffRecordHeader aExMediaAtomHd;
2045 if ( SeekToRec( rStCtrl, PPT_PST_ExMediaAtom, aExVideoHd.GetRecEndFilePos(), &aExMediaAtomHd ) )
2047 sal_uInt32 nRef;
2048 rStCtrl >> nRef;
2049 if ( nRef == nMediaRef )
2051 aExVideoHd.SeekToContent( rStCtrl );
2052 while( rStCtrl.Tell() < aExVideoHd.GetRecEndFilePos() )
2054 DffRecordHeader aHd;
2055 rStCtrl >> aHd;
2056 switch( aHd.nRecType )
2058 case PPT_PST_CString :
2060 aHd.SeekToBegOfRecord( rStCtrl );
2061 String aStr;
2062 if ( ReadString( aStr ) )
2064 if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aStr, aRetVal ) )
2066 aRetVal = INetURLObject( aRetVal ).GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
2070 break;
2072 aHd.SeekToEndOfRecord( rStCtrl );
2074 break;
2079 break;
2081 aHdMovie.SeekToEndOfRecord( rStCtrl );
2084 return aRetVal;
2087 //////////////////////////////////////////////////////////////////////////
2089 // Import von Objekten
2091 //////////////////////////////////////////////////////////////////////////
2093 void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, String aMacroName )
2095 // Lokale Informationen in pInfo eintragen
2096 if( pIAtom->nSoundRef )
2098 pInfo->maBookmark = ReadSound( pIAtom->nSoundRef ); // Pfad zum Soundfile in MSDOS-Notation
2099 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_SOUND; // RunProgramAction
2101 // if ( nFlags & 0x01 ) // koennen wir nicht ( beim Anklicken markieren )
2102 switch ( pIAtom->nAction )
2104 // case 0x01 : // MacroAction
2105 // {
2106 // pInfo->meClickAction = ::com::sun::star::presentation::::com::sun::star::presentation::ClickAction_MACRO;
2107 // // aMacro liegt in folgender Form vor:
2108 // // "Macroname.Modulname.Libname.Dokumentname" oder
2109 // // "Macroname.Modulname.Libname.Applikationsname"
2110 // pInfo->maBookmark = aMacroName;
2111 // }
2112 // break;
2113 case 0x02 : // RunProgramAction
2115 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
2116 pInfo->maBookmark = aMacroName; // Programmname in aBookmark
2118 break;
2119 case 0x03 : // JumpAction
2121 switch( pIAtom->nJump )
2123 case 0x01 :
2124 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NEXTPAGE; // Next slide
2125 break;
2126 case 0x02 :
2127 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Previous slide
2128 break;
2129 case 0x03 :
2130 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_FIRSTPAGE; // First slide
2131 break;
2132 case 0x04 :
2133 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_LASTPAGE; // last Slide
2134 break;
2135 case 0x05 :
2136 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Last slide viewed
2137 break;
2138 case 0x06 :
2139 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_STOPPRESENTATION; // End show
2140 break;
2141 default :
2142 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NONE; // 0x00: no action, else unknown
2143 break;
2146 break;
2147 case 0x04 :
2149 SdHyperlinkEntry* pPtr;
2150 for ( pPtr = (SdHyperlinkEntry*)aHyperList.First(); pPtr; pPtr = (SdHyperlinkEntry*)aHyperList.Next() )
2152 if ( pPtr->nIndex == pIAtom->nExHyperlinkId )
2153 break;
2155 if ( pPtr )
2157 switch( pIAtom->nHyperlinkType )
2159 case 9:
2160 case 10:
2161 break;
2162 case 8: // hyperlink : URL
2164 if ( pPtr->aTarget.Len() )
2166 pInfo->maBookmark = String( pPtr->aTarget );
2167 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_DOCUMENT;
2170 break;
2171 case 7: // hyperlink auf eine Seite
2173 if ( pPtr->aConvSubString.Len() )
2175 pInfo->maBookmark = pPtr->aConvSubString;
2176 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_BOOKMARK;
2179 break;
2183 break;
2184 case 0x05 : // OLEAction ( OLEVerb to use, 0==first, 1==secnd, .. )
2185 case 0x06 : // MediaAction
2186 case 0x07 : // CustomShowAction
2187 default : // 0x00: no action, else unknown action
2188 break;
2192 SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj, SdPage* pPage,
2193 SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
2195 SfxStyleSheet* pStyleSheetAry[ 9 ];
2196 SdrTextObj* pText = pObj;
2197 SdrObject* pRet = pText;
2199 ppStyleSheetAry = NULL;
2201 PresObjKind ePresKind = PRESOBJ_NONE;
2202 PptOEPlaceholderAtom* pPlaceHolder = pTextObj->GetOEPlaceHolderAtom();
2203 String aPresentationText;
2204 if ( pPlaceHolder )
2206 switch( pPlaceHolder->nPlaceholderId )
2208 case PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE :
2209 case PPT_PLACEHOLDER_MASTERCENTEREDTITLE :
2210 case PPT_PLACEHOLDER_MASTERTITLE :
2212 ePresKind = PRESOBJ_TITLE;
2213 aPresentationText = pPage->GetPresObjText( ePresKind );
2215 break;
2216 case PPT_PLACEHOLDER_MASTERBODY :
2218 ePresKind = PRESOBJ_OUTLINE;
2219 aPresentationText = pPage->GetPresObjText( ePresKind );
2221 break;
2222 case PPT_PLACEHOLDER_MASTERSUBTITLE :
2224 ePresKind = PRESOBJ_TEXT;
2225 aPresentationText = pPage->GetPresObjText( ePresKind );
2227 break;
2228 case PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE :
2230 ePresKind = PRESOBJ_NOTES;
2231 aPresentationText = pPage->GetPresObjText( ePresKind );
2233 break;
2234 case PPT_PLACEHOLDER_MASTERDATE : ePresKind = PRESOBJ_DATETIME; break;
2235 case PPT_PLACEHOLDER_MASTERSLIDENUMBER : ePresKind = PRESOBJ_SLIDENUMBER;break;
2236 case PPT_PLACEHOLDER_MASTERFOOTER : ePresKind = PRESOBJ_FOOTER; break;
2237 case PPT_PLACEHOLDER_MASTERHEADER : ePresKind = PRESOBJ_HEADER; break;
2240 switch ( pTextObj->GetDestinationInstance() )
2242 case TSS_TYPE_PAGETITLE :
2243 case TSS_TYPE_TITLE :
2245 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2246 if ( pSheet )
2247 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2248 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2250 break;
2251 case TSS_TYPE_SUBTITLE :
2253 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
2254 if ( pSheet )
2255 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2256 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" );
2258 break;
2259 case TSS_TYPE_BODY :
2260 case TSS_TYPE_HALFBODY :
2261 case TSS_TYPE_QUARTERBODY :
2263 for ( UINT16 nLevel = 9; nLevel; nLevel-- )
2265 String aName( pPage->GetLayoutName() );
2266 aName.Append( (sal_Unicode)( ' ' ) );
2267 aName.Append( String::CreateFromInt32( nLevel ) );
2268 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
2269 if ( pSheet )
2270 pText->StartListening( *pSheet );
2271 pStyleSheetAry[ nLevel - 1 ] = pSheet;
2273 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for outlinerobject (SJ)" );
2274 if ( pSheet )
2275 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2276 ppStyleSheetAry = &pStyleSheetAry[ 0 ];
2278 break;
2279 case TSS_TYPE_NOTES :
2281 if ( pPlaceHolder && ( ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_NOTESSLIDEIMAGE )
2282 || ( pPlaceHolder->nPlaceholderId == PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) ) )
2284 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2285 if ( pSheet )
2286 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2287 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2289 else
2291 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
2292 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for notesobj (SJ)" );
2293 if ( pSheet )
2294 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, TRUE );
2297 break;
2298 case TSS_TYPE_UNUSED :
2299 case TSS_TYPE_TEXT_IN_SHAPE :
2301 switch( ePresKind )
2303 case PRESOBJ_DATETIME :
2304 case PRESOBJ_SLIDENUMBER :
2305 case PRESOBJ_FOOTER :
2306 case PRESOBJ_HEADER :
2307 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )), SD_STYLE_FAMILY_PSEUDO );
2308 break;
2309 default :
2310 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME )), SD_STYLE_FAMILY_GRAPHICS );
2313 break;
2315 pText = (SdrTextObj*)SdrPowerPointImport::ApplyTextObj( pTextObj, pText, pPage, pSheet, ppStyleSheetAry );
2316 if ( pPlaceHolder && pPlaceHolder->nPlaceholderId )
2318 if ( eAktPageKind == PPT_MASTERPAGE )
2320 sal_Bool bCreatePlaceHolder = ( pTextObj->GetInstance() != TSS_TYPE_SUBTITLE ) && ( pTextObj->GetInstance() != TSS_TYPE_UNUSED );
2321 sal_Bool bIsHeaderFooter = ( ePresKind == PRESOBJ_HEADER) || (ePresKind == PRESOBJ_FOOTER)
2322 || (ePresKind == PRESOBJ_DATETIME) || (ePresKind == PRESOBJ_SLIDENUMBER);
2323 if ( bCreatePlaceHolder && ( pTextObj->GetInstance() == TSS_TYPE_TEXT_IN_SHAPE ) )
2324 bCreatePlaceHolder = bIsHeaderFooter;
2325 if ( bCreatePlaceHolder )
2327 if ( !bIsHeaderFooter )
2329 pText->SetNotVisibleAsMaster( TRUE );
2330 pText->SetEmptyPresObj( TRUE );
2332 pText->SetUserCall( pPage );
2333 pPage->InsertPresObj( pText, ePresKind );
2334 SdrOutliner* pOutl = NULL;
2335 if ( pTextObj->GetInstance() == TSS_TYPE_NOTES )
2336 pOutl = GetDrawOutliner( pText );
2337 if ( aPresentationText.Len() )
2338 pPage->SetObjText( (SdrTextObj*)pText, pOutl, ePresKind, aPresentationText );
2340 SfxStyleSheet* pSheet2( pPage->GetStyleSheetForPresObj( ePresKind ) );
2341 if ( pSheet2 )
2343 SfxItemSet& rItemSet = pSheet2->GetItemSet();
2344 rItemSet.Put( (SdrTextLeftDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LEFTDIST ) );
2345 rItemSet.Put( (SdrTextRightDistItem&)pText->GetMergedItem( SDRATTR_TEXT_RIGHTDIST ) );
2346 rItemSet.Put( (SdrTextUpperDistItem&)pText->GetMergedItem( SDRATTR_TEXT_UPPERDIST ) );
2347 rItemSet.Put( (SdrTextLowerDistItem&)pText->GetMergedItem( SDRATTR_TEXT_LOWERDIST ) );
2349 pText->NbcSetStyleSheet( pSheet2, TRUE );
2351 SfxItemSet aTempAttr( mpDoc->GetPool() );
2352 SdrTextMinFrameHeightItem aMinHeight( pText->GetLogicRect().GetSize().Height() );
2353 aTempAttr.Put( aMinHeight );
2354 SdrTextAutoGrowHeightItem aAutoGrowHeight( FALSE );
2355 aTempAttr.Put( aAutoGrowHeight );
2356 pText->SetMergedItemSet(aTempAttr);
2358 else
2360 pRet = NULL;
2363 else
2365 const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
2366 if ( pSlideLayout || ( eAktPageKind == PPT_NOTEPAGE ) )
2368 INT16 nPlaceholderId = pPlaceHolder->nPlaceholderId;
2369 UINT16 i = 0;
2370 if ( eAktPageKind == PPT_SLIDEPAGE )
2372 for ( ; i < 8; i++ )
2374 if ( pSlideLayout->aPlaceholderId[ i ] == nPlaceholderId )
2375 break;
2378 if ( i < 8 )
2380 PresObjKind ePresObjKind = PRESOBJ_NONE;
2381 sal_Bool bEmptyPresObj = sal_True;
2382 sal_Bool bVertical = sal_False;
2383 if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
2385 if ( pTextObj->Count() )
2386 bEmptyPresObj = sal_False;
2387 switch ( nPlaceholderId )
2389 case PPT_PLACEHOLDER_NOTESBODY : ePresObjKind = PRESOBJ_NOTES; break;
2390 case PPT_PLACEHOLDER_VERTICALTEXTTITLE :
2391 bVertical = sal_True; // PASSTHROUGH !!!
2392 case PPT_PLACEHOLDER_TITLE : ePresObjKind = PRESOBJ_TITLE; break;
2393 case PPT_PLACEHOLDER_VERTICALTEXTBODY :
2394 bVertical = sal_True; // PASSTHROUGH !!!
2395 case PPT_PLACEHOLDER_BODY : ePresObjKind = PRESOBJ_OUTLINE; break;
2396 case PPT_PLACEHOLDER_CENTEREDTITLE : ePresObjKind = PRESOBJ_TITLE; break;
2397 case PPT_PLACEHOLDER_SUBTITLE : ePresObjKind = PRESOBJ_TEXT; break; // PRESOBJ_OUTLINE
2399 default :
2401 if ( !pTextObj->Count() )
2403 switch ( nPlaceholderId )
2405 case PPT_PLACEHOLDER_MEDIACLIP :
2406 case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
2407 case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
2408 case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_TABLE; break;
2409 case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
2410 case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
2416 else if ( pTextObj->GetShapeType() == mso_sptPictureFrame )
2418 if ( !pTextObj->Count() && pObj->ISA( SdrGrafObj ) )
2420 bEmptyPresObj = sal_False;
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;
2432 if ( ePresObjKind != PRESOBJ_NONE )
2434 if ( !bEmptyPresObj )
2436 pPage->InsertPresObj( pRet, ePresObjKind );
2438 else
2440 SdrObject* pPresObj = pPage->CreatePresObj( ePresObjKind, bVertical, pText->GetLogicRect(), TRUE );
2441 pPresObj->SetUserCall( pPage );
2443 SfxItemSet aSet( pSdrModel->GetItemPool() );
2444 ApplyAttributes( rStCtrl, aSet );
2445 pPresObj->SetMergedItemSet(aSet);
2447 if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( pSlideLayout->aPlacementId[ i ] != (ULONG)-1 ) )
2449 SdrObject* pTitleObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
2450 SdrObject* pOutlineObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
2452 Rectangle aTitleRect;
2453 Rectangle aOutlineRect;
2454 Size aOutlineSize;
2456 if ( pTitleObj )
2457 aTitleRect = pTitleObj->GetLogicRect();
2458 if ( pOutlineObj )
2460 aOutlineRect = pOutlineObj->GetLogicRect();
2461 aOutlineSize = aOutlineRect.GetSize();
2463 Rectangle aLogicRect( pPresObj->GetLogicRect() );
2464 Size aLogicSize( aLogicRect.GetSize() );
2466 switch ( pSlideLayout->aPlacementId[ i ] )
2468 case 0 : // Lage im Titelbereich
2470 if ( aLogicRect != aTitleRect )
2471 pPresObj->SetUserCall( NULL );
2473 break;
2475 case 1:
2477 if ( pSlideLayout->eLayout == PPT_LAYOUT_TITLEANDBODYSLIDE )
2478 { // Lage im Outlinebereich
2479 if ( aLogicRect != aOutlineRect )
2480 pPresObj->SetUserCall( NULL );
2482 else if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
2483 { // Lage im Outlinebereich links
2484 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2485 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2486 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2487 aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
2488 aLogicSize.Width() / aOutlineSize.Width() > 0.5)
2490 pPresObj->SetUserCall(NULL);
2493 else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
2494 { // Lage im Outlinebereich oben
2495 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2496 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2497 Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
2499 pPresObj->SetUserCall( NULL );
2502 else if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2503 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
2504 { // Lage im Outlinebereich links oben
2505 pPresObj->SetUserCall( NULL );
2508 break;
2510 case 2:
2512 if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
2513 { // Lage im Outlinebereich rechts
2514 if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2515 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2516 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2517 aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
2518 aLogicSize.Width() / aOutlineSize.Width() > 0.5)
2520 pPresObj->SetUserCall( NULL );
2523 else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
2524 { // Lage im Outlinebereich unten
2525 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2526 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2527 Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
2529 pPresObj->SetUserCall( NULL );
2532 else if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2533 Abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
2534 { // Lage im Outlinebereich rechts oben
2535 pPresObj->SetUserCall(NULL);
2538 break;
2540 case 3:
2541 { // Lage im Outlinebereich links unten
2542 if (Abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2543 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
2545 pPresObj->SetUserCall( NULL );
2548 break;
2550 case 4:
2551 { // Lage im Outlinebereich rechts unten
2552 if (Abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2553 Abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
2555 pObj->SetUserCall( NULL );
2558 break;
2561 pRet = NULL; // return zero cause this obj was already inserted by CreatePresObj
2564 else if ( !pTextObj->Count() )
2565 pRet = NULL;
2570 if ( pRet != pText )
2572 SdrObject* pFree( pText );
2573 SdrObject::Free( pFree );
2575 return pRet;
2578 SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pRet )
2580 SdrObject* pObj = SdrPowerPointImport::ProcessObj( rSt, rObjData, pData, rTextRect, pRet );
2582 // Animationseffekte des Objektes lesen
2583 if ( pObj )
2585 BOOL bInhabitanceChecked = FALSE;
2586 BOOL bAnimationInfoFound = FALSE;
2587 DffRecordHeader aMasterShapeHd;
2589 if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
2591 DffRecordHeader& rHdClientData = *maShapeRecords.Current();
2592 while( TRUE )
2594 UINT32 nClientDataLen = rHdClientData.GetRecEndFilePos();
2595 DffRecordHeader aHd;
2598 rSt >> aHd;
2599 UINT32 nHdRecEnd = aHd.GetRecEndFilePos();
2600 switch ( aHd.nRecType )
2602 case PPT_PST_AnimationInfo :
2604 DffRecordHeader aHdAnimInfoAtom;
2605 if ( SeekToRec( rSt, PPT_PST_AnimationInfoAtom, nHdRecEnd, &aHdAnimInfoAtom ) )
2607 // read data from stream
2608 Ppt97AnimationPtr pAnimation( new Ppt97Animation( rSt ) );
2609 // store animation informations
2610 if( pAnimation->HasEffect() )
2612 // translate color to RGB
2613 pAnimation->SetDimColor( MSO_CLR_ToColor(pAnimation->GetDimColor()).GetColor() );
2614 // translate sound bits to file url
2615 if( pAnimation->HasSoundEffect() )
2616 pAnimation->SetSoundFileUrl( ReadSound( pAnimation->GetSoundRef() ) );
2618 bool bDontAnimateInvisibleShape = false;
2620 SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
2622 if( pTextObj && pTextObj->HasText() &&
2623 !pObj->ISA( SdrObjGroup ) &&
2624 pAnimation->HasAnimateAssociatedShape() )
2626 const SfxItemSet& rObjItemSet = pObj->GetMergedItemSet();
2628 XFillStyle eFillStyle = ((XFillStyleItem&)(rObjItemSet.Get(XATTR_FILLSTYLE))).GetValue();
2629 XLineStyle eLineStyle = ((XLineStyleItem&)(rObjItemSet.Get(XATTR_LINESTYLE))).GetValue();
2631 if ( ( eFillStyle == XFILL_NONE ) && ( eLineStyle == XLINE_NONE ) )
2632 bDontAnimateInvisibleShape = true;
2635 if( bDontAnimateInvisibleShape )
2636 pAnimation->SetAnimateAssociatedShape(false);
2638 //maybe some actions necessary to ensure that animations on master pages are played before animations on normal pages
2639 ///mabe todo in future: bool bIsEffectOnMasterPage = !bInhabitanceChecked;?
2641 maAnimations[pObj] = pAnimation;
2643 bAnimationInfoFound = TRUE;
2647 break;
2648 case PPT_PST_InteractiveInfo:
2650 UINT32 nFilePosMerk2 = rSt.Tell();
2651 String aMacroName;
2653 if(SeekToRec( rSt, PPT_PST_CString, nHdRecEnd, NULL, 0 ) )
2654 ReadString(aMacroName);
2656 rSt.Seek( nFilePosMerk2 );
2657 DffRecordHeader aHdInteractiveInfoAtom;
2658 if ( SeekToRec( rSt, PPT_PST_InteractiveInfoAtom, nHdRecEnd, &aHdInteractiveInfoAtom ) )
2660 PptInteractiveInfoAtom aInteractiveInfoAtom;
2661 rSt >> aInteractiveInfoAtom;
2663 // interactive object
2664 SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
2666 ( (ImplSdPPTImport*) this )->FillSdAnimationInfo( pInfo, &aInteractiveInfoAtom, aMacroName );
2667 if ( aInteractiveInfoAtom.nAction == 6 ) // Sj -> media action
2669 rHdClientData.SeekToContent( rStCtrl );
2670 DffRecordHeader aObjRefAtomHd;
2671 if ( SeekToRec( rSt, PPT_PST_ExObjRefAtom, nHdRecEnd, &aObjRefAtomHd ) )
2673 sal_uInt32 nRef;
2674 rSt >> nRef;
2675 String aMediaURL( ReadMedia( nRef ) );
2676 if ( !aMediaURL.Len() )
2677 aMediaURL = ReadSound( nRef );
2678 if ( aMediaURL.Len() )
2680 SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() );
2681 pMediaObj->SetModel( pObj->GetModel() );
2682 pMediaObj->SetMergedItemSet( pObj->GetMergedItemSet() );
2684 //--remove object from maAnimations list and add the new object instead
2685 Ppt97AnimationPtr pAnimation;
2687 tAnimationMap::iterator aFound = maAnimations.find( pObj );
2688 if( aFound != maAnimations.end() )
2690 pAnimation = (*aFound).second;
2691 maAnimations.erase(aFound);
2693 maAnimations[pMediaObj] = pAnimation;
2695 //--
2697 SdrObject::Free( pObj ), pObj = pMediaObj; // SJ: hoping that pObj is not inserted in any list
2698 pMediaObj->setURL( aMediaURL );
2704 break;
2706 aHd.SeekToEndOfRecord( rSt );
2708 while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) );
2710 if ( bInhabitanceChecked || bAnimationInfoFound )
2711 break;
2712 bInhabitanceChecked = TRUE;
2713 if ( ! ( IsProperty( DFF_Prop_hspMaster ) && SeekToShape( rSt, pData, GetPropertyValue( DFF_Prop_hspMaster ) ) ) )
2714 break;
2715 rSt >> aMasterShapeHd;
2716 if ( !SeekToRec( rSt, DFF_msofbtClientData, aMasterShapeHd.GetRecEndFilePos(), &aMasterShapeHd ) )
2717 break;
2718 aMasterShapeHd.SeekToContent( rSt );
2719 rHdClientData = aMasterShapeHd;
2723 return pObj;
2726 // ---------------------
2727 // - exported function -
2728 // ---------------------
2730 extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL ImportPPT( const ::rtl::OUString& rConfigPath,
2731 uno::Sequence< beans::PropertyValue >* pConfigData,
2732 SdDrawDocument* pDocument, SvStream& rDocStream, SvStorage& rStorage, SfxMedium& rMedium )
2734 sal_Bool bRet = sal_False;
2736 MSFilterTracer aTracer( rConfigPath, pConfigData );
2737 aTracer.StartTracing();
2739 SdPPTImport* pImport = new SdPPTImport( pDocument, rDocStream, rStorage, rMedium, &aTracer );
2740 bRet = pImport->Import();
2742 aTracer.EndTracing();
2743 delete pImport;
2745 return bRet;