bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / filter / ppt / pptin.cxx
blob8cdaaff33d7d284b6a2801cb6291513cf08abd90
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <editeng/numitem.hxx>
22 #include <unotools/ucbstreamhelper.hxx>
23 #include <vcl/wrkwin.hxx>
24 #include <svl/urihelper.hxx>
25 #include <svx/svxids.hrc>
26 #include <filter/msfilter/svdfppt.hxx>
27 #include <svx/svditer.hxx>
28 #include <sfx2/docfile.hxx>
29 #include <sfx2/app.hxx>
30 #include <svx/svdograf.hxx>
31 #include <svx/svdlayer.hxx>
32 #include <vcl/msgbox.hxx>
33 #include <svl/style.hxx>
34 #include <svx/xflclit.hxx>
35 #include <editeng/eeitem.hxx>
36 #include <editeng/colritem.hxx>
37 #include <svl/whiter.hxx>
38 #include <svx/xgrad.hxx>
39 #include <svx/xflgrit.hxx>
40 #include <svx/xbtmpit.hxx>
41 #include <svx/xlnclit.hxx>
42 #include <editeng/adjustitem.hxx>
43 #include <editeng/editeng.hxx>
44 #include <editeng/bulletitem.hxx>
45 #include <editeng/lrspitem.hxx>
46 #include <editeng/lspcitem.hxx>
47 #include <editeng/tstpitem.hxx>
49 #include <sfx2/docinf.hxx>
51 #include "glob.hrc"
52 #include "pptin.hxx"
53 #include "Outliner.hxx"
54 #include "drawdoc.hxx"
55 #include "sdpage.hxx"
56 #include "sdresid.hxx"
57 #include "pres.hxx"
58 #include "stlpool.hxx"
59 #include "anminfo.hxx"
60 #include <svx/gallery.hxx>
61 #include <tools/urlobj.hxx>
62 #include <svl/itempool.hxx>
63 #include <editeng/fhgtitem.hxx>
64 #include <svx/svdopage.hxx>
65 #include <svx/svdomedia.hxx>
66 #include <svx/svdogrp.hxx>
67 #include "propread.hxx"
68 #include <cusshow.hxx>
69 #include <vcl/bmpacc.hxx>
70 #include "customshowlist.hxx"
72 #include "../../ui/inc/DrawDocShell.hxx"
73 #include "../../ui/inc/FrameView.hxx"
74 #include "../../ui/inc/optsitem.hxx"
76 #include <unotools/fltrcfg.hxx>
77 #include <sfx2/progress.hxx>
78 #include <unotools/localfilehelper.hxx>
79 #include <editeng/editstat.hxx>
80 #include <unotools/pathoptions.hxx>
81 #include <sfx2/docfac.hxx>
82 #define MAX_USER_MOVE 2
84 #include "pptinanimations.hxx"
85 #include "ppt97animations.hxx"
87 #include <com/sun/star/document/XDocumentProperties.hpp>
88 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
89 #include <com/sun/star/drawing/LineStyle.hpp>
91 #include <comphelper/string.hxx>
92 #include <oox/ole/olehelper.hxx>
94 #include <cassert>
95 #include <memory>
97 using namespace ::com::sun::star;
99 SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotStorage& rStorage, SfxMedium& rMedium )
102 sal_uInt32 nImportFlags = 0;
104 #ifdef DBG_UTIL
105 PropRead* pSummaryInformation = new PropRead( rStorage, OUString( "\005SummaryInformation" ) );
106 if ( pSummaryInformation->IsValid() )
108 pSummaryInformation->Read();
109 sal_uInt8 aPropSetGUID[ 16 ] =
111 0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9
113 Section* pSection = const_cast<Section*>(pSummaryInformation->GetSection( aPropSetGUID ));
114 if ( pSection )
116 PropItem aPropItem;
117 if ( pSection->GetProperty( PID_COMMENTS, aPropItem ) )
119 OUString aComment;
120 aPropItem.Read( aComment );
121 if ( aComment.indexOf( "Applixware" ) >= 0 )
123 nImportFlags |= PPT_IMPORTFLAGS_NO_TEXT_ASSERT;
128 delete pSummaryInformation;
129 #endif
131 PowerPointImportParam aParam( rDocStream, nImportFlags );
132 SvStream* pCurrentUserStream = rStorage.OpenSotStream( OUString( "Current User" ), STREAM_STD_READ );
133 if( pCurrentUserStream )
135 ReadPptCurrentUserAtom( *pCurrentUserStream, aParam.aCurrentUserAtom );
136 delete pCurrentUserStream;
139 if( pDocument )
141 // iterate over all styles
142 SdStyleSheetPool* pStyleSheetPool = pDocument->GetSdStyleSheetPool();
143 SfxStyleSheetIteratorPtr aIter =
144 std::make_shared<SfxStyleSheetIterator>(pStyleSheetPool, SFX_STYLE_FAMILY_ALL);
146 for (SfxStyleSheetBase *pSheet = aIter->First(); pSheet; pSheet = aIter->Next())
148 SfxItemSet& rSet = pSheet->GetItemSet();
149 // if autokerning is set in style, override it, ppt has no autokerning
150 if( rSet.GetItemState( EE_CHAR_PAIRKERNING, false ) == SfxItemState::SET )
151 rSet.ClearItem( EE_CHAR_PAIRKERNING );
155 pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
158 bool SdPPTImport::Import()
160 return pFilter->Import();
163 SdPPTImport::~SdPPTImport()
165 delete pFilter;
168 ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SotStorage& rStorage_, SfxMedium& rMedium, PowerPointImportParam& rParam )
169 : SdrPowerPointImport(rParam, rMedium.GetBaseURL())
170 , mrMed(rMedium)
171 , mrStorage(rStorage_)
172 , mbDocumentFound(false)
173 , mnFilterOptions(0)
174 , mpDoc(pDocument)
175 , mePresChange(PRESCHANGE_MANUAL)
176 , mnBackgroundLayerID(0)
177 , mnBackgroundObjectsLayerID(0)
179 if ( bOk )
181 mbDocumentFound = SeekToDocument( &maDocHd ); // maDocHd = the latest DocumentHeader
182 while ( SeekToRec( rStCtrl, PPT_PST_Document, nStreamLen, &maDocHd ) )
183 mbDocumentFound = true;
185 sal_uInt32 nDggContainerOfs = 0;
187 if ( mbDocumentFound )
189 sal_uLong nPosMerk = rStCtrl.Tell();
191 pStData = rStorage_.OpenSotStream( OUString( "Pictures" ), STREAM_STD_READ );
193 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
194 sal_uLong nDocLen = maDocHd.GetRecEndFilePos();
195 DffRecordHeader aPPDGHd;
196 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawingGroup, nDocLen, &aPPDGHd ) )
198 sal_uLong nPPDGLen = aPPDGHd.GetRecEndFilePos();
199 if ( SeekToRec( rStCtrl, DFF_msofbtDggContainer, nPPDGLen, NULL ) )
200 nDggContainerOfs = rStCtrl.Tell();
202 rStCtrl.Seek( nPosMerk );
204 sal_uInt32 nSvxMSDffOLEConvFlags2 = 0;
206 const SvtFilterOptions& rBasOpt = SvtFilterOptions::Get();
207 if ( rBasOpt.IsLoadPPointBasicCode() )
208 mnFilterOptions |= 1;
209 if ( rBasOpt.IsMathType2Math() )
210 nSvxMSDffOLEConvFlags2 |= OLE_MATHTYPE_2_STARMATH;
211 if ( rBasOpt.IsWinWord2Writer() )
212 nSvxMSDffOLEConvFlags2 |= OLE_WINWORD_2_STARWRITER;
213 if ( rBasOpt.IsExcel2Calc() )
214 nSvxMSDffOLEConvFlags2 |= OLE_EXCEL_2_STARCALC;
215 if ( rBasOpt.IsPowerPoint2Impress() )
216 nSvxMSDffOLEConvFlags2 |= OLE_POWERPOINT_2_STARIMPRESS;
218 InitSvxMSDffManager( nDggContainerOfs, pStData, nSvxMSDffOLEConvFlags2 );
219 SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS
220 | SVXMSDFF_SETTINGS_IMPORT_PPT );
221 SetModel( mpDoc, 576 );
225 // Dtor
226 ImplSdPPTImport::~ImplSdPPTImport()
228 delete pStData;
231 // Import
232 bool ImplSdPPTImport::Import()
234 if ( !bOk )
235 return false;
237 pSdrModel->setLock(true);
238 pSdrModel->EnableUndo(false);
240 SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
241 EEControlBits nControlWord = rOutl.GetEditEngine().GetControlWord();
242 nControlWord |= EEControlBits::ULSPACESUMMATION;
243 nControlWord &= ~EEControlBits::ULSPACEFIRSTPARA;
244 ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
246 SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
247 mnBackgroundLayerID = rAdmin.GetLayerID( SD_RESSTR( STR_LAYER_BCKGRND ), false );
248 mnBackgroundObjectsLayerID = rAdmin.GetLayerID( SD_RESSTR( STR_LAYER_BCKGRNDOBJ ), false );
250 ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
251 if ( pDocShell )
252 SeekOle( pDocShell, mnFilterOptions );
254 // hyperlinks
255 PropRead* pDInfoSec2 = new PropRead( mrStorage, OUString( "\005DocumentSummaryInformation" ) );
256 if ( pDInfoSec2->IsValid() )
258 PropItem aPropItem;
260 sal_uInt32 nType, nPropSize, nPropCount;
262 pDInfoSec2->Read();
264 sal_uInt8 aPropSetGUID[ 16 ] =
266 0x02, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
268 Section* pSection = const_cast<Section*>(pDInfoSec2->GetSection( aPropSetGUID ));
269 if ( pSection )
271 if ( pSection->GetProperty( PID_SLIDECOUNT, aPropItem ) )
273 aPropItem.ReadUInt32( nType );
274 if ( ( nType == VT_I4 ) || ( nType == VT_UI4 ) )
276 // examine PID_HEADINGPAIR to get the correct entry for PID_DOCPARTS
277 sal_uInt32 nSlideCount, nVecCount;
278 aPropItem.ReadUInt32( nSlideCount );
279 if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
281 sal_uInt32 nSlideTitleIndex = 0, nSlideTitleCount = 0;
283 OUString aUString;
285 aPropItem.ReadUInt32( nType )
286 .ReadUInt32( nVecCount );
288 if ( ( nType == ( VT_VARIANT | VT_VECTOR ) ) && ( nVecCount ^ 1 ) )
290 nVecCount >>= 1;
291 sal_uInt32 nEntryCount = 0;
292 for (sal_uInt32 i = 0; i < nVecCount; ++i)
294 if ( !aPropItem.Read( aUString, VT_EMPTY, false ) )
295 break;
296 aPropItem.ReadUInt32( nType );
297 if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
298 break;
299 sal_uInt32 nTemp(0);
300 aPropItem.ReadUInt32( nTemp );
301 if ( aUString == "Slide Titles" || aUString == "Folientitel" )
303 nSlideTitleCount = nTemp;
304 nSlideTitleIndex = nEntryCount;
306 nEntryCount += nTemp;
309 if ( ( nSlideCount == nSlideTitleCount ) && pSection->GetProperty( PID_DOCPARTS, aPropItem ) )
311 aPropItem.ReadUInt32( nType )
312 .ReadUInt32( nVecCount );
314 bool bVecOk = ( ( nVecCount >= (nSlideTitleIndex + nSlideTitleCount) )
315 && ( nType == ( VT_LPSTR | VT_VECTOR ) ) );
317 if (bVecOk)
319 for (sal_uInt32 i = 0; i != nSlideTitleIndex; ++i)
321 sal_uInt32 nTemp(0);
322 aPropItem.ReadUInt32(nTemp);
323 if (!aPropItem.good())
325 bVecOk = false;
326 break;
328 auto nPos = aPropItem.Tell() + nTemp;
329 if (nPos != aPropItem.Seek(nPos))
331 bVecOk = false;
332 break;
336 if (bVecOk)
338 for (sal_uInt32 i = 0; i < nSlideTitleCount; ++i)
340 if (!aPropItem.Read(aUString, nType, false))
341 break;
343 OUString aString( aUString );
344 if ( aString == "No Slide Title" )
345 aString.clear();
346 else
348 std::vector<OUString>::const_iterator pIter =
349 std::find(maSlideNameList.begin(),maSlideNameList.end(),aString);
351 if (pIter != maSlideNameList.end())
352 aString.clear();
354 maSlideNameList.push_back( aString );
362 sal_uInt8 aUserPropSetGUID[ 16 ] =
364 0x05, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
366 pSection = const_cast<Section*>(pDInfoSec2->GetSection( aUserPropSetGUID ));
367 if ( pSection )
369 Dictionary aDict;
370 pSection->GetDictionary(aDict);
371 if (!aDict.empty())
373 Dictionary::const_iterator iter = aDict.find( OUString("_PID_HLINKS") );
375 if ( iter != aDict.end() )
377 if ( pSection->GetProperty( iter->second, aPropItem ) )
379 aPropItem.Seek( STREAM_SEEK_TO_BEGIN );
380 aPropItem.ReadUInt32( nType );
381 if ( nType == VT_BLOB )
383 aPropItem.ReadUInt32( nPropSize )
384 .ReadUInt32( nPropCount );
386 if ( ! ( nPropCount % 6 ) )
388 sal_uInt32 i;
390 nPropCount /= 6; // 6 properties per hyperlink
392 SdHyperlinkEntry* pHyperlink = 0;
393 for ( i = 0; i < nPropCount; i++ )
395 pHyperlink = new SdHyperlinkEntry;
396 pHyperlink->nIndex = 0;
397 aPropItem.ReadUInt32( nType );
398 if ( nType != VT_I4 )
399 break;
400 aPropItem.ReadInt32( pHyperlink->nPrivate1 )
401 .ReadUInt32( nType );
402 if ( nType != VT_I4 )
403 break;
404 aPropItem.ReadInt32( pHyperlink->nPrivate2 )
405 .ReadUInt32( nType );
406 if ( nType != VT_I4 )
407 break;
408 aPropItem.ReadInt32( pHyperlink->nPrivate3 )
409 .ReadUInt32( nType );
410 if ( nType != VT_I4 )
411 break;
412 aPropItem.ReadInt32( pHyperlink->nInfo );
413 if ( !aPropItem.Read( pHyperlink->aTarget, VT_EMPTY ) )
414 break;
416 // Convert '\\' notation to 'smb://'
417 INetURLObject aUrl( pHyperlink->aTarget, INetProtocol::File );
418 pHyperlink->aTarget = aUrl.GetMainURL( INetURLObject::NO_DECODE );
420 if ( !aPropItem.Read( pHyperlink->aSubAdress, VT_EMPTY ) )
421 break;
422 pHyperlink->nStartPos = pHyperlink->nEndPos = -1;
424 if ( !pHyperlink->aSubAdress.isEmpty() ) // get the converted subaddress
426 sal_uInt32 nPageNumber = 0;
427 OUString aString( pHyperlink->aSubAdress );
428 OString aStringAry[ 3 ];
429 sal_uInt16 nTokenCount = comphelper::string::getTokenCount(aString, ',');
430 if ( nTokenCount > 3 )
431 nTokenCount = 3;
432 sal_uInt16 nToken;
433 for( nToken = 0; nToken < nTokenCount; nToken++ )
434 aStringAry[nToken] = OUStringToOString(aString.getToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8);
436 bool bDocInternalSubAddress = false;
438 // first pass, searching for a SlideId
439 for( nToken = 0; nToken < nTokenCount; nToken++ )
441 if (comphelper::string::isdigitAsciiString(aStringAry[nToken]))
443 sal_Int32 nNumber = aStringAry[ nToken ].toInt32();
444 if ( nNumber & ~0xff )
446 PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
447 if ( pPageList )
449 sal_uInt16 nPage = pPageList->FindPage( nNumber );
450 if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
452 nPageNumber = nPage;
453 bDocInternalSubAddress = true;
454 break;
460 if ( !bDocInternalSubAddress )
461 { // second pass, searching for a SlideName
462 for ( nToken = 0; nToken < nTokenCount; nToken++ )
464 OUString aToken(OStringToOUString(aStringAry[nToken], RTL_TEXTENCODING_UTF8));
465 std::vector<OUString>::const_iterator pIter =
466 std::find(maSlideNameList.begin(),maSlideNameList.end(),aToken);
468 if (pIter != maSlideNameList.end())
470 nPageNumber = pIter - maSlideNameList.begin();
471 bDocInternalSubAddress = true;
475 if ( !bDocInternalSubAddress )
476 { // third pass, searching for a slide number
477 for ( nToken = 0; nToken < nTokenCount; nToken++ )
479 if (comphelper::string::isdigitAsciiString(aStringAry[nToken]))
481 sal_Int32 nNumber = aStringAry[ nToken ].toInt32();
482 if ( ( nNumber & ~0xff ) == 0 )
484 nPageNumber = (sal_uInt32)nNumber - 1;
485 bDocInternalSubAddress = true;
486 break;
491 // if a document internal sub address
492 if ( bDocInternalSubAddress )
494 if ( nPageNumber < maSlideNameList.size() )
495 pHyperlink->aConvSubString = maSlideNameList[ nPageNumber ];
496 if ( pHyperlink->aConvSubString.isEmpty() )
498 pHyperlink->aConvSubString = OUString( SdResId( STR_PAGE ) ) + " " + ( mpDoc->CreatePageNumValue( (sal_uInt16)nPageNumber + 1 ) );
500 } else {
501 // if sub address is given but not internal, use it as it is
502 if ( pHyperlink->aConvSubString.isEmpty() )
504 pHyperlink->aConvSubString = aString;
508 aHyperList.push_back( pHyperlink );
510 if ( i != nPropCount )
511 delete pHyperlink;
520 delete pDInfoSec2;
522 if ( mbDocumentFound )
524 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
525 // read hyperlist / set indices of the entries
526 DffRecordHeader aHyperHd;
527 if ( SeekToRec( rStCtrl, PPT_PST_ExObjList, maDocHd.GetRecEndFilePos(), &aHyperHd ) )
529 sal_uInt32 nExObjHyperListLen = aHyperHd.GetRecEndFilePos();
530 for ( size_t i = 0, n = aHyperList.size(); i < n; ++i )
532 SdHyperlinkEntry* pPtr = aHyperList[ i ];
533 DffRecordHeader aHyperE;
534 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlink, nExObjHyperListLen, &aHyperE ) )
535 break;
536 if ( !SeekToRec( rStCtrl, PPT_PST_ExHyperlinkAtom, nExObjHyperListLen, NULL, 0 ) )
537 break;
538 rStCtrl.SeekRel( 8 );
539 rStCtrl.ReadUInt32( pPtr->nIndex );
540 if (!aHyperE.SeekToEndOfRecord(rStCtrl))
541 break;
546 Size aVisAreaSize;
547 switch ( aUserEditAtom.eLastViewType )
549 case 5 : // notes master
550 case 3 : // notes
551 aVisAreaSize = aDocAtom.GetNotesPageSize();
552 break;
553 default :
554 aVisAreaSize = aDocAtom.GetSlidesPageSize();
556 Scale( aVisAreaSize );
557 pDocShell->SetVisArea( Rectangle( Point(), aVisAreaSize ) );
559 // create master pages:
561 SfxProgress* pStbMgr = new SfxProgress( pDocShell, SD_RESSTR( STR_POWERPOINT_IMPORT ),
562 pMasterPages->size() + pSlidePages->size() + pNotePages->size() );
564 sal_uInt32 nImportedPages = 0;
566 sal_uInt16 nMasterAnz = GetPageCount( PPT_MASTERPAGE );
568 for ( sal_uInt16 nMasterNum = 0; nMasterNum < nMasterAnz; nMasterNum++ )
570 SetPageNum( nMasterNum, PPT_MASTERPAGE );
571 SdPage* pPage = static_cast<SdPage*>(MakeBlancPage( true ));
572 if ( pPage )
574 bool bNotesMaster = (*GetPageList( eAktPageKind ) )[ nAktPageNum ].bNotesMaster;
575 bool bStarDrawFiller = (*GetPageList( eAktPageKind ) )[ nAktPageNum ].bStarDrawFiller;
577 PageKind ePgKind = ( bNotesMaster ) ? PK_NOTES : PK_STANDARD;
578 bool bHandout = (*GetPageList( eAktPageKind ) )[ nAktPageNum ].bHandoutMaster;
579 if ( bHandout )
580 ePgKind = PK_HANDOUT;
582 pPage->SetPageKind( ePgKind );
583 pSdrModel->InsertMasterPage( (SdrPage*)pPage );
584 if ( bNotesMaster && bStarDrawFiller )
585 pPage->SetAutoLayout( AUTOLAYOUT_NOTES, true );
586 if ( nMasterNum )
588 boost::optional< sal_Int16 > oStartNumbering;
589 SfxStyleSheet* pSheet;
590 if ( nMasterNum == 1 )
592 // standardsheet
593 pSheet = static_cast<SfxStyleSheet*>(mpDoc->GetStyleSheetPool()->Find(SD_RESSTR(STR_STANDARD_STYLESHEET_NAME), SD_STYLE_FAMILY_GRAPHICS ));
594 if ( pSheet )
596 SfxItemSet& rItemSet = pSheet->GetItemSet();
597 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
598 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
599 aParagraph.AppendPortion( aPortion );
600 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
601 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
605 // PSEUDO
606 pSheet = static_cast<SfxStyleSheet*>(mpDoc->GetStyleSheetPool()->Find(SD_RESSTR(STR_PSEUDOSHEET_BACKGROUNDOBJECTS), SD_STYLE_FAMILY_PSEUDO ));
607 if ( pSheet )
609 SfxItemSet& rItemSet = pSheet->GetItemSet();
610 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
611 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 );
612 aParagraph.AppendPortion( aPortion );
613 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
614 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
617 // create layoutstylesheets, set layoutname and stylesheet
618 // (only on standard and not pages)
620 OUString aLayoutName( SD_RESSTR( STR_LAYOUT_DEFAULT_NAME ) );
621 if ( nMasterNum > 2 )
623 if ( ePgKind == PK_STANDARD )
624 { // standard page: create new presentation layout
625 aLayoutName = SD_RESSTR( STR_LAYOUT_DEFAULT_TITLE_NAME );
626 aLayoutName += OUString::number( (sal_Int32)( ( nMasterNum + 1 ) / 2 - 1 ) );
627 static_cast<SdStyleSheetPool*>( mpDoc->GetStyleSheetPool() )->CreateLayoutStyleSheets( aLayoutName );
629 else // note page: use presentation layout of standard page
630 aLayoutName = static_cast<SdPage*>( mpDoc->GetMasterPage( nMasterNum - 1 ) )->GetName();
632 pPage->SetName( aLayoutName );
633 aLayoutName += SD_LT_SEPARATOR;
634 aLayoutName += SD_RESSTR( STR_LAYOUT_OUTLINE );
635 pPage->SetLayoutName( aLayoutName );
637 // set stylesheets
638 if ( pPage->GetPageKind() == PK_STANDARD )
640 sal_uInt32 nTitleInstance = TSS_TYPE_PAGETITLE;
641 sal_uInt32 nOutlinerInstance = TSS_TYPE_BODY;
642 const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
643 bool bSwapStyleSheet = pSlideLayout->eLayout == PptSlideLayout::TITLEMASTERSLIDE;
644 if ( bSwapStyleSheet )
646 nTitleInstance = TSS_TYPE_TITLE;
647 nOutlinerInstance = TSS_TYPE_SUBTITLE;
650 // titelstylesheet
651 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
652 if ( pSheet )
654 SfxItemSet& rItemSet = pSheet->GetItemSet();
655 PPTParagraphObj aParagraph( *pPPTStyleSheet, nTitleInstance, 0 );
656 PPTPortionObj aPortion( *pPPTStyleSheet, nTitleInstance, 0 );
657 aParagraph.AppendPortion( aPortion );
658 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
659 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
662 // outlinerstylesheet
663 sal_uInt16 nLevel;
664 PPTParagraphObj* pParagraphs[ 9 ];
665 PPTParagraphObj* pPreviousPara = NULL;
667 for ( nLevel = 0; nLevel < 9; nLevel++ )
669 OUString aName( pPage->GetLayoutName() );
670 aName += " ";
671 aName += OUString::number( nLevel + 1 );
672 SfxStyleSheet* pOutlineSheet = static_cast<SfxStyleSheet*>( mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE ) );
673 DBG_ASSERT( pOutlineSheet, "Template for outline object not found" );
674 if ( pOutlineSheet )
676 pParagraphs[ nLevel ] = new PPTParagraphObj( *pPPTStyleSheet, nOutlinerInstance, nLevel );
677 SfxItemSet& rItemSet = pOutlineSheet->GetItemSet();
678 PPTPortionObj aPortion( *pPPTStyleSheet, nOutlinerInstance, nLevel );
679 pParagraphs[ nLevel ]->AppendPortion( aPortion );
680 pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, pPreviousPara );
681 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
682 pPreviousPara = pParagraphs[ nLevel ];
684 else
685 pParagraphs[ nLevel ] = NULL;
687 for ( nLevel = 0; nLevel < 9; delete pParagraphs[ nLevel++ ] ) ;
689 // subtitle stylesheet
690 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
691 if ( pSheet )
693 SfxItemSet& rItemSet = pSheet->GetItemSet();
694 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
695 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 );
696 aParagraph.AppendPortion( aPortion );
697 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
698 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
701 else if ( ePgKind == PK_NOTES )
703 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
704 if ( pSheet )
706 SfxItemSet& rItemSet = pSheet->GetItemSet();
707 PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
708 PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 );
709 aParagraph.AppendPortion( aPortion );
710 aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, NULL );
711 aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff );
718 SdPage* pMPage;
719 sal_uInt16 i;
720 for ( i = 0; i < mpDoc->GetMasterPageCount() && ( (pMPage = static_cast<SdPage*>(mpDoc->GetMasterPage( i ))) != 0 ); i++ )
722 SetPageNum( i, PPT_MASTERPAGE );
724 // importing master page objects
725 PptSlidePersistList* pList = GetPageList( eAktPageKind );
726 PptSlidePersistEntry* pPersist = ( pList && ( nAktPageNum < pList->size() ) )
727 ? &(*pList)[ nAktPageNum ] : NULL;
728 if ( pPersist )
730 if ( pPersist->bStarDrawFiller && pPersist->bNotesMaster && ( nAktPageNum > 2 ) && ( ( nAktPageNum & 1 ) == 0 ) )
732 pSdrModel->DeleteMasterPage( nAktPageNum );
733 SdrPage* pNotesClone = static_cast<SdPage*>(pSdrModel->GetMasterPage( 2 ))->Clone();
734 pSdrModel->InsertMasterPage( pNotesClone, nAktPageNum );
735 if ( pNotesClone )
737 OUString aLayoutName( static_cast<SdPage*>(pSdrModel->GetMasterPage( nAktPageNum - 1 ))->GetLayoutName() );
738 static_cast<SdPage*>(pNotesClone)->SetPresentationLayout( aLayoutName, false, false, false );
739 static_cast<SdPage*>(pNotesClone)->SetLayoutName( aLayoutName );
742 else if ( !pPersist->bStarDrawFiller )
744 PptSlidePersistEntry* pE = pPersist;
745 while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
747 auto nOrigMasterId = pE->aSlideAtom.nMasterId;
748 sal_uInt16 nNextMaster = pMasterPages->FindPage(nOrigMasterId);
749 if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
750 break;
751 else
752 pE = &(*pList)[ nNextMaster ];
753 if (pE->aSlideAtom.nMasterId == nOrigMasterId)
755 SAL_WARN("filter.ms", "loop in atom chain");
756 break;
759 SdrObject* pObj = ImportPageBackgroundObject( *pMPage, pE->nBackgroundOffset, true ); // import background
760 if ( pObj )
761 pMPage->NbcInsertObject( pObj );
763 bool bNewAnimationsUsed = false;
764 ProcessData aProcessData( (*pList)[ nAktPageNum ], SdPageCapsule(pMPage) );
765 sal_uInt32 nFPosMerk = rStCtrl.Tell();
766 DffRecordHeader aPageHd;
767 if ( SeekToAktPage( &aPageHd ) )
769 auto nEndRecPos = SanitizeEndPos(rStCtrl, aPageHd.GetRecEndFilePos());
770 while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nEndRecPos ) )
772 DffRecordHeader aHd;
773 ReadDffRecordHeader( rStCtrl, aHd );
774 switch( aHd.nRecType )
776 case PPT_PST_PPDrawing :
778 aHd.SeekToBegOfRecord( rStCtrl );
779 DffRecordHeader aPPDrawHd;
780 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
782 sal_uInt32 nPPDrawEnd = aPPDrawHd.GetRecEndFilePos();
783 DffRecordHeader aEscherF002Hd;
784 if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, nPPDrawEnd, &aEscherF002Hd ) )
786 sal_uInt32 nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
787 DffRecordHeader aEscherObjListHd;
788 if ( SeekToRec( rStCtrl, DFF_msofbtSpgrContainer, nEscherF002End, &aEscherObjListHd ) )
790 sal_uInt32 nObjCount = 0;
791 auto nListEndRecPos = SanitizeEndPos(rStCtrl, aEscherObjListHd.GetRecEndFilePos());
792 while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nListEndRecPos ) )
794 DffRecordHeader aHd2;
795 ReadDffRecordHeader( rStCtrl, aHd2 );
796 if ( ( aHd2.nRecType == DFF_msofbtSpContainer ) || ( aHd2.nRecType == DFF_msofbtSpgrContainer ) )
798 if ( nObjCount++ ) // skipping the first object
800 Rectangle aEmpty;
801 if (!aHd2.SeekToBegOfRecord( rStCtrl ))
802 break;
803 SdrObject* pImpObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
804 if ( pImpObj )
806 pImpObj->SetLayer( mnBackgroundObjectsLayerID );
807 pMPage->NbcInsertObject( pImpObj );
811 if (!aHd2.SeekToEndOfRecord(rStCtrl))
812 break;
818 break;
820 case PPT_PST_ProgTags :
822 DffRecordHeader aProgTagHd;
823 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
825 auto nTagEndRecPos = SanitizeEndPos(rStCtrl, aProgTagHd.GetRecEndFilePos());
826 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nTagEndRecPos ) )
828 DffRecordHeader aProgTagContentHd;
829 ReadDffRecordHeader( rStCtrl, aProgTagContentHd );
830 switch( aProgTagContentHd.nRecType )
832 case DFF_msofbtAnimGroup :
834 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pMPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
835 ppt::AnimationImporter aImporter( this, rStCtrl );
836 bNewAnimationsUsed = aImporter.import( xPage, aProgTagContentHd ) > 0;
838 break;
840 if (!aProgTagContentHd.SeekToEndOfRecord(rStCtrl))
841 break;
845 break;
847 bool bSuccess = aHd.SeekToEndOfRecord(rStCtrl);
848 if (!bSuccess)
850 SAL_WARN("filter.ms", "Count not seek to end of record");
851 break;
855 rStCtrl.Seek( nFPosMerk );
856 ImportPageEffect( pMPage, bNewAnimationsUsed );
858 // background object
859 pObj = pMPage->GetObj( 0 );
860 if ( pObj && pObj->GetObjIdentifier() == OBJ_RECT )
862 if ( pMPage->GetPageKind() == PK_STANDARD )
864 // transform data from imported background object to new form
865 // and delete the object. It was used as container to transport
866 // the attributes of the MasterPage background fill
867 SfxStyleSheet* pSheet = pMPage->GetStyleSheetForMasterPageBackground();
869 if(pSheet)
871 // if we have a StyleSheet (for Masterpages), set attributes there and use it
872 pSheet->GetItemSet().ClearItem();
873 pSheet->GetItemSet().Put(pObj->GetMergedItemSet());
874 pMPage->getSdrPageProperties().ClearItem();
875 pMPage->getSdrPageProperties().SetStyleSheet(pSheet);
877 else
879 // without StyleSheet, set attributes directly. This
880 // should not be done at all and is an error (will be asserted by SdrPage)
881 pMPage->getSdrPageProperties().ClearItem();
882 pMPage->getSdrPageProperties().PutItemSet(pObj->GetMergedItemSet());
885 pMPage->RemoveObject(pObj->GetOrdNum());
886 SdrObject::Free(pObj);
891 pStbMgr->SetState( nImportedPages++ );
894 // importing slide pages
896 sal_uInt32 nFPosMerk = rStCtrl.Tell();
897 PptPageKind ePageKind = eAktPageKind;
898 sal_uInt16 nPageNum = nAktPageNum;
900 SdPage* pHandoutPage = static_cast<SdPage*>(MakeBlancPage( false ));
901 pHandoutPage->SetPageKind( PK_HANDOUT );
902 pSdrModel->InsertPage( pHandoutPage );
904 sal_uInt16 nPageAnz = GetPageCount( PPT_SLIDEPAGE );
905 if ( nPageAnz )
907 for ( sal_uInt16 nPage = 0; nPage < nPageAnz; nPage++ )
909 mePresChange = PRESCHANGE_SEMIAUTO;
910 SetPageNum( nPage, PPT_SLIDEPAGE );
911 SdPage* pPage = static_cast<SdPage*>(MakeBlancPage( false ));
912 PptSlidePersistEntry* pMasterPersist = NULL;
913 if ( HasMasterPage( nPage, PPT_SLIDEPAGE ) ) // try to get the LayoutName from the masterpage
915 sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
916 pPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nMasterNum));
917 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
918 if ( pPageList && nMasterNum < pPageList->size() )
919 pMasterPersist = &(*pPageList)[ nMasterNum ];
920 pPage->SetLayoutName(static_cast<SdPage&>(pPage->TRG_GetMasterPage()).GetLayoutName());
922 pPage->SetPageKind( PK_STANDARD );
923 pSdrModel->InsertPage( pPage ); // SJ: #i29625# because of form controls, the
924 ImportPage( pPage, pMasterPersist ); // page must be inserted before importing
925 SetHeaderFooterPageSettings( pPage, pMasterPersist );
926 // CWS preseng01: pPage->SetPageKind( PK_STANDARD );
928 DffRecordHeader aPageHd;
929 if ( SeekToAktPage( &aPageHd ) )
931 bool bNewAnimationsUsed = false;
933 aPageHd.SeekToContent( rStCtrl );
934 auto nEndRecPos = SanitizeEndPos(rStCtrl, aPageHd.GetRecEndFilePos());
935 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nEndRecPos ) )
937 DffRecordHeader aHd;
938 ReadDffRecordHeader( rStCtrl, aHd );
939 switch ( aHd.nRecType )
941 case PPT_PST_ProgTags :
943 DffRecordHeader aProgTagHd;
944 if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
946 auto nHdEndRecPos = SanitizeEndPos(rStCtrl, aProgTagHd.GetRecEndFilePos());
947 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nHdEndRecPos ) )
949 DffRecordHeader aProgTagContentHd;
950 ReadDffRecordHeader( rStCtrl, aProgTagContentHd );
951 switch( aProgTagContentHd.nRecType )
953 case DFF_msofbtAnimGroup :
955 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xPage( pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY );
956 ppt::AnimationImporter aImporter( this, rStCtrl );
957 bNewAnimationsUsed = aImporter.import( xPage, aProgTagContentHd ) > 0;
959 break;
961 case PPT_PST_HashCodeAtom : // ???
962 break;
964 case PPT_PST_SlideTime10Atom : // ??? don't know, this atom is always 8 bytes big
965 break; // and is appearing in nearly every l10 progtag
967 if (!aProgTagContentHd.SeekToEndOfRecord(rStCtrl))
968 break;
972 break;
974 case PPT_PST_HeadersFooters :
975 case PPT_PST_PPDrawing :
976 default:
977 break;
980 if (!aHd.SeekToEndOfRecord(rStCtrl))
981 break;
983 ImportPageEffect( pPage, bNewAnimationsUsed );
986 // creating the corresponding note page
987 eAktPageKind = PPT_NOTEPAGE;
988 SdPage* pNotesPage = static_cast<SdPage*>(MakeBlancPage( false ));
989 sal_uInt16 nNotesMasterNum = GetMasterPageIndex( nPage, PPT_SLIDEPAGE ) + 1;
990 sal_uInt32 nNotesPageId = GetNotesPageId( nPage );
991 if ( nNotesPageId )
993 nImportedPages++;
994 sal_uInt16 nNotesPageIndex = pNotePages->FindPage( nNotesPageId );
995 if ( nNotesPageIndex == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
996 nNotesPageIndex = 0;
997 SetPageNum( nNotesPageIndex, PPT_NOTEPAGE );
998 PptSlidePersistEntry* pMasterPersist2 = NULL;
999 if ( HasMasterPage( nNotesPageIndex, PPT_NOTEPAGE ) ) // try to get the LayoutName from the masterpage
1001 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1002 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
1003 if ( pPageList && nNotesMasterNum < pPageList->size() )
1004 pMasterPersist2 = &(*pPageList)[ nNotesMasterNum ];
1005 pNotesPage->SetLayoutName( static_cast<SdPage&>(pNotesPage->TRG_GetMasterPage()).GetLayoutName() );
1007 pNotesPage->SetPageKind( PK_NOTES );
1008 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1009 pSdrModel->InsertPage( pNotesPage ); // SJ: #i29625# because of form controls, the
1010 ImportPage( pNotesPage, pMasterPersist2 ); // page must be inserted before importing
1011 SetHeaderFooterPageSettings( pNotesPage, pMasterPersist2 );
1012 pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, false );
1014 else
1016 pNotesPage->SetPageKind( PK_NOTES );
1017 pNotesPage->TRG_SetMasterPage(*pSdrModel->GetMasterPage(nNotesMasterNum));
1018 pNotesPage->SetAutoLayout( AUTOLAYOUT_NOTES, true );
1019 pSdrModel->InsertPage( pNotesPage );
1020 SdrObject* pPageObj = pNotesPage->GetPresObj( PRESOBJ_PAGE, 1 );
1021 if ( pPageObj )
1022 static_cast<SdrPageObj*>(pPageObj)->SetReferencedPage(pSdrModel->GetPage(( nPage << 1 ) + 1));
1025 pStbMgr->SetState( nImportedPages++ );
1028 else
1030 // that can happen by document templates
1031 eAktPageKind = PPT_SLIDEPAGE;
1032 SdrPage* pPage = MakeBlancPage( false );
1033 pSdrModel->InsertPage( pPage );
1035 // #i37397#, trying to set the title master for the first page
1036 sal_uInt16 nMaster, nMasterCount = pSdrModel->GetMasterPageCount();
1037 SdPage* pFoundMaster = NULL;
1038 for ( nMaster = 1; nMaster < nMasterCount; nMaster++ )
1040 SdPage* pMaster = static_cast<SdPage*>( pSdrModel->GetMasterPage( nMaster ) );
1041 if ( pMaster->GetPageKind() == PK_STANDARD )
1043 SetPageNum( nMaster, PPT_MASTERPAGE );
1044 if ( !pFoundMaster )
1045 pFoundMaster = pMaster;
1046 else if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE )
1047 pFoundMaster = pMaster;
1048 if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE )
1049 break;
1052 if ( pFoundMaster )
1054 static_cast<SdPage*>(pPage)->TRG_SetMasterPage( *pFoundMaster );
1055 static_cast<SdPage*>(pPage)->SetLayoutName( pFoundMaster->GetLayoutName() );
1057 static_cast<SdPage*>(pPage)->SetAutoLayout( AUTOLAYOUT_TITLE, true, true );
1059 eAktPageKind = PPT_NOTEPAGE;
1060 SdrPage* pNPage = MakeBlancPage( false );
1061 pSdrModel->InsertPage( pNPage );
1063 SetPageNum( nPageNum, ePageKind );
1064 rStCtrl.Seek( nFPosMerk );
1067 // create handout and note pages
1068 bOk = mpDoc->CreateMissingNotesAndHandoutPages();
1069 if ( bOk )
1071 for ( i = 0; i < mpDoc->GetSdPageCount( PK_STANDARD ); i++ )
1074 // set AutoLayout
1075 SetPageNum( i, PPT_SLIDEPAGE );
1076 SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
1077 AutoLayout eAutoLayout = AUTOLAYOUT_NONE;
1078 const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
1079 if ( pSlideLayout )
1081 switch ( pSlideLayout->eLayout ) // presentation layout for standard pages
1083 case PptSlideLayout::TITLEANDBODYSLIDE :
1085 eAutoLayout = AUTOLAYOUT_ENUM;
1086 PptPlaceholder nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1087 switch ( nID1 )
1089 case PptPlaceholder::BODY :
1090 eAutoLayout = AUTOLAYOUT_ENUM;
1091 break;
1092 case PptPlaceholder::TABLE :
1093 eAutoLayout = AUTOLAYOUT_TAB;
1094 break;
1095 case PptPlaceholder::ORGANISZATIONCHART :
1096 eAutoLayout = AUTOLAYOUT_ORG;
1097 break;
1098 case PptPlaceholder::GRAPH :
1099 eAutoLayout = AUTOLAYOUT_CHART;
1100 break;
1101 case PptPlaceholder::OBJECT :
1102 eAutoLayout = AUTOLAYOUT_OBJ;
1103 break;
1104 case PptPlaceholder::VERTICALTEXTBODY :
1105 eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE;
1106 break;
1107 default: break;
1110 break;
1112 case PptSlideLayout::TWOCOLUMNSANDTITLE :
1114 eAutoLayout = AUTOLAYOUT_2TEXT;
1115 PptPlaceholder nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1116 PptPlaceholder nID2 = pSlideLayout->aPlaceholderId[ 2 ];
1117 if ( nID1 == PptPlaceholder::BODY && nID2 == PptPlaceholder::GRAPH )
1118 eAutoLayout = AUTOLAYOUT_TEXTCHART;
1119 else if ( nID1 == PptPlaceholder::GRAPH && nID2 == PptPlaceholder::BODY )
1120 eAutoLayout = AUTOLAYOUT_CHARTTEXT;
1121 else if ( nID1 == PptPlaceholder::BODY && nID2 == PptPlaceholder::CLIPART )
1122 eAutoLayout = AUTOLAYOUT_TEXTCLIP;
1123 else if ( nID1 == PptPlaceholder::CLIPART && nID2 == PptPlaceholder::BODY )
1124 eAutoLayout = AUTOLAYOUT_CLIPTEXT;
1125 else if ( nID1 == PptPlaceholder::CLIPART && nID2 == PptPlaceholder::VERTICALTEXTBODY )
1126 eAutoLayout = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART;
1127 else if ( ( nID1 == PptPlaceholder::BODY )
1128 && ( ( nID2 == PptPlaceholder::OBJECT ) || ( nID2 == PptPlaceholder::MEDIACLIP ) ) )
1129 eAutoLayout = AUTOLAYOUT_TEXTOBJ;
1130 else if ( ( nID2 == PptPlaceholder::BODY )
1131 && ( ( nID1 == PptPlaceholder::OBJECT ) || ( nID1 == PptPlaceholder::MEDIACLIP ) ) )
1132 eAutoLayout = AUTOLAYOUT_OBJTEXT;
1133 else if ( ( nID1 == PptPlaceholder::OBJECT ) && ( nID2 == PptPlaceholder::OBJECT ) )
1134 eAutoLayout = AUTOLAYOUT_OBJ;
1136 break;
1138 case PptSlideLayout::TWOROWSANDTITLE :
1140 eAutoLayout = AUTOLAYOUT_2TEXT;
1141 PptPlaceholder nID1 = pSlideLayout->aPlaceholderId[ 1 ];
1142 PptPlaceholder nID2 = pSlideLayout->aPlaceholderId[ 2 ];
1143 if ( nID1 == PptPlaceholder::BODY && nID2 == PptPlaceholder::OBJECT )
1144 eAutoLayout = AUTOLAYOUT_TEXTOVEROBJ;
1145 else if ( nID1 == PptPlaceholder::OBJECT && nID2 == PptPlaceholder::BODY )
1146 eAutoLayout = AUTOLAYOUT_OBJOVERTEXT;
1148 break;
1150 case PptSlideLayout::TITLESLIDE :
1151 eAutoLayout = AUTOLAYOUT_TITLE;
1152 break;
1153 case PptSlideLayout::ONLYTITLE :
1154 eAutoLayout = AUTOLAYOUT_ONLY_TITLE;
1155 break;
1156 case PptSlideLayout::RIGHTCOLUMN2ROWS :
1157 eAutoLayout = AUTOLAYOUT_TEXT2OBJ;
1158 break;
1159 case PptSlideLayout::LEFTCOLUMN2ROWS :
1160 eAutoLayout = AUTOLAYOUT_2OBJTEXT;
1161 break;
1162 case PptSlideLayout::TOPROW2COLUMN :
1163 eAutoLayout = AUTOLAYOUT_2OBJOVERTEXT;
1164 break;
1165 case PptSlideLayout::FOUROBJECTS :
1166 eAutoLayout = AUTOLAYOUT_4OBJ;
1167 break;
1168 case PptSlideLayout::BIGOBJECT :
1169 eAutoLayout = AUTOLAYOUT_OBJ;
1170 break;
1171 case PptSlideLayout::TITLERIGHTBODYLEFT :
1172 eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE; // AUTOLAYOUT_ENUM;
1173 break;
1174 case PptSlideLayout::TITLERIGHT2BODIESLEFT :
1175 eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART; // AUTOLAYOUT_TEXT2OBJ;
1176 break;
1178 case PptSlideLayout::BOTTOMROW2COLUMNS :
1179 case PptSlideLayout::BLANCSLIDE :
1180 case PptSlideLayout::MASTERSLIDE : // layout of the standard and title master page
1181 case PptSlideLayout::TITLEMASTERSLIDE :
1182 case PptSlideLayout::MASTERNOTES : // layout of the note master page
1183 case PptSlideLayout::NOTESTITLEBODY : // presentation layout for note pages
1184 case PptSlideLayout::HANDOUTLAYOUT : // presentation layout for handout
1185 eAutoLayout = AUTOLAYOUT_NONE;
1186 break;
1188 if ( eAutoLayout != AUTOLAYOUT_NONE )
1189 pPage->SetAutoLayout( eAutoLayout, false );
1193 // handout master page: auto layout
1194 SdPage* pHandoutMPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
1195 pHandoutMPage->SetAutoLayout( AUTOLAYOUT_HANDOUT6, true, true );
1198 sal_uInt32 nSlideCount = GetPageCount();
1199 for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.size() ); i++ )
1201 SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
1202 OUString &aName = maSlideNameList[ i ];
1203 if ( pPage )
1205 if ( !aName.isEmpty() )
1206 pPage->SetName( aName );
1207 else
1208 aName = pPage->GetName();
1211 if ( mbDocumentFound )
1213 mpDoc->SetSummationOfParagraphs( true );
1214 if ( pDocShell )
1216 ::sd::FrameView* pFrameView = mpDoc->GetFrameView( 0 );
1217 if ( !pFrameView )
1219 std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
1220 pFrameView = new ::sd::FrameView( mpDoc );
1221 rViews.push_back( pFrameView );
1223 if ( pFrameView )
1225 sal_uInt16 nSelectedPage = 0;
1226 PageKind ePageKind = PK_STANDARD;
1227 EditMode eEditMode = EM_PAGE;
1229 switch ( aUserEditAtom.eLastViewType )
1231 case 7 : // outliner view
1233 SfxItemSet* pSet = mrMed.GetItemSet();
1234 if ( pSet )
1235 pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
1237 break;
1238 case 8 : // slide sorter
1240 SfxItemSet* pSet = mrMed.GetItemSet();
1241 if ( pSet )
1242 pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
1244 break;
1245 case 10 : // titlemaster
1246 nSelectedPage = 1;
1247 //fall-through
1248 case 2 : // master
1250 ePageKind = PK_STANDARD;
1251 eEditMode = EM_MASTERPAGE;
1253 break;
1254 case 5 : // notes master
1255 eEditMode = EM_MASTERPAGE;
1256 //fall-through
1257 case 3 : // notes
1258 ePageKind = PK_NOTES;
1259 break;
1260 case 4 : // handout
1261 ePageKind = PK_HANDOUT;
1262 break;
1263 default :
1264 case 1 : // normal
1265 break;
1267 pFrameView->SetPageKind( ePageKind );
1268 pFrameView->SetSelectedPage( nSelectedPage );
1269 pFrameView->SetViewShEditMode( eEditMode, ePageKind );
1272 DffRecordHeader aCustomShowHeader;
1273 // read and set custom show
1274 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
1275 if ( SeekToRec( rStCtrl, PPT_PST_NamedShows, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
1277 DffRecordHeader aCuHeader;
1278 while( SeekToRec( rStCtrl, PPT_PST_NamedShow, aCustomShowHeader.GetRecEndFilePos(), &aCuHeader ) )
1280 DffRecordHeader aContent;
1281 if ( SeekToRec( rStCtrl, PPT_PST_CString, aCuHeader.GetRecEndFilePos(), &aContent ) )
1283 OUString aCuShow;
1284 aContent.SeekToBegOfRecord( rStCtrl );
1285 if ( ReadString( aCuShow ) )
1287 if ( SeekToRec( rStCtrl, PPT_PST_NamedShowSlides, aCuHeader.GetRecEndFilePos(), &aContent ) )
1289 PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE );
1290 sal_uInt32 nSCount = aContent.nRecLen >> 2;
1291 if ( pPageList && nSCount )
1293 SdCustomShowList* pList = mpDoc->GetCustomShowList( true );
1294 if ( pList )
1296 SdCustomShow* pSdCustomShow = new SdCustomShow( mpDoc );
1297 pSdCustomShow->SetName( aCuShow );
1298 sal_uInt32 nFound = 0;
1299 for ( sal_uInt32 nS = 0; nS < nSCount; nS++ )
1301 sal_uInt32 nPageNumber;
1302 rStCtrl.ReadUInt32( nPageNumber );
1303 sal_uInt16 nPage = pPageList->FindPage( nPageNumber );
1304 if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
1306 SdPage* pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
1307 if ( pPage )
1309 pSdCustomShow->PagesVector().push_back( pPage );
1310 nFound++;
1314 if ( nFound )
1315 pList->push_back( pSdCustomShow );
1316 else
1317 delete pSdCustomShow;
1325 // this is defaulted, maybe there is no SSDocInfoAtom
1326 OUStringBuffer aCustomShow;
1327 sal_uInt32 nFlags = 1; // Bit 0: Auto advance
1328 sal_uInt16 nStartSlide = 0;
1330 // read the pres. configuration
1331 rStCtrl.Seek( maDocHd.GetRecBegFilePos() + 8 );
1332 if ( SeekToRec( rStCtrl, PPT_PST_SSDocInfoAtom, maDocHd.GetRecEndFilePos(), &aCustomShowHeader ) )
1334 sal_uInt32 nPenColor = 0x1000000;
1335 sal_Int32 nRestartTime = 0x7fffffff;
1336 sal_Int16 nEndSlide = 0;
1337 rStCtrl.ReadUInt32( nPenColor )
1338 .ReadInt32( nRestartTime )
1339 .ReadUInt16( nStartSlide )
1340 .ReadInt16( nEndSlide );
1342 sal_Unicode nChar;
1343 for ( sal_uInt32 i2 = 0; i2 < 32; i2++ )
1345 rStCtrl.ReadUInt16( nChar );
1346 if ( nChar )
1347 aCustomShow.append( nChar );
1348 else
1350 rStCtrl.SeekRel( ( 31 - i2 ) << 1 );
1351 break;
1354 rStCtrl.ReadUInt32( nFlags );
1356 // set the current custom show
1357 if ( !aCustomShow.isEmpty() )
1359 SdCustomShowList* pList = mpDoc->GetCustomShowList( false );
1360 if ( pList )
1362 SdCustomShow* pPtr = NULL;
1363 OUString aCustomShowStr = aCustomShow.makeStringAndClear();
1364 for( pPtr = pList->First(); pPtr; pPtr = pList->Next() )
1366 if ( pPtr->GetName() == aCustomShowStr )
1367 break;
1369 if ( !pPtr )
1370 pList->First();
1373 sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
1375 rPresSettings.mbManual = ( nFlags & 1 ) == 0;
1376 rPresSettings.mbAnimationAllowed = ( nFlags & 2 ) == 0;
1377 rPresSettings.mbAll = ( nFlags & 4 ) == 0;
1378 rPresSettings.mbCustomShow = ( nFlags & 8 ) != 0;
1379 rPresSettings.mbEndless = ( nFlags & 0x80 ) != 0;
1380 rPresSettings.mbFullScreen = ( nFlags & 0x10 ) == 0;
1382 if ( nStartSlide && ( nStartSlide <= GetPageCount() ) )
1384 SdPage* pPage = mpDoc->GetSdPage( nStartSlide - 1, PK_STANDARD );
1385 if ( pPage )
1386 rPresSettings.maPresPage = pPage->GetName();
1390 delete pStbMgr;
1392 // read DocumentProperties
1393 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1394 mpDoc->GetObjectShell()->GetModel(), uno::UNO_QUERY_THROW);
1395 uno::Reference<document::XDocumentProperties> xDocProps
1396 = xDPS->getDocumentProperties();
1397 sfx2::LoadOlePropertySet(xDocProps, &mrStorage);
1398 xDocProps->setTemplateName(OUString());
1400 pSdrModel->setLock(false);
1401 pSdrModel->EnableUndo(true);
1402 return bOk;
1405 void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist )
1407 sal_uInt32 i;
1408 PptSlidePersistList* pList = GetPageList( eAktPageKind );
1409 if ( ( !pList ) || ( pList->size() <= nAktPageNum ) )
1410 return;
1411 PptSlidePersistEntry& rSlidePersist = (*pList)[ nAktPageNum ];
1412 HeaderFooterEntry* pHFE = rSlidePersist.pHeaderFooterEntry;
1413 if ( pHFE )
1415 for ( i = 0; i < 4; i++ )
1417 bool bVisible = pHFE->IsToDisplay( i );
1418 if ( ( eAktPageKind == PPT_SLIDEPAGE )
1419 && ( rSlidePersist.aSlideAtom.aLayout.eLayout == PptSlideLayout::TITLESLIDE )
1420 && ( aDocAtom.bTitlePlaceholdersOmitted ) )
1422 bVisible = false;
1424 if ( bVisible && pMasterPersist )
1426 sal_uInt32 nPosition = pHFE->NeedToImportInstance( i, rSlidePersist );
1427 if ( nPosition )
1429 Rectangle aEmpty;
1430 bVisible = false;
1431 rStCtrl.Seek( nPosition );
1432 ProcessData aProcessData( rSlidePersist, SdPageCapsule(pPage) );
1433 SdrObject* pObj = ImportObj( rStCtrl, (void*)&aProcessData, aEmpty, aEmpty );
1434 if ( pObj )
1435 pPage->NbcInsertObject( pObj, 0 );
1438 OUString aPlaceHolderString = pHFE->pPlaceholder[ i ];
1440 sd::HeaderFooterSettings rHeaderFooterSettings( pPage->getHeaderFooterSettings() );
1441 switch( i )
1443 case 0 :
1445 rHeaderFooterSettings.mbDateTimeVisible = bVisible;
1446 rHeaderFooterSettings.mbDateTimeIsFixed = ( pHFE->nAtom & 0x20000 ) == 0;
1447 rHeaderFooterSettings.maDateTimeText = aPlaceHolderString;
1448 SvxDateFormat eDateFormat;
1449 SvxTimeFormat eTimeFormat;
1450 PPTFieldEntry::GetDateTime( pHFE->nAtom & 0xff, eDateFormat, eTimeFormat );
1451 rHeaderFooterSettings.meDateTimeFormat = eDateFormat | ( eTimeFormat << 4 );
1453 break;
1454 case 1 :
1456 rHeaderFooterSettings.mbHeaderVisible = bVisible;
1457 rHeaderFooterSettings.maHeaderText = aPlaceHolderString;
1459 break;
1460 case 2 :
1462 rHeaderFooterSettings.mbFooterVisible = bVisible;
1463 rHeaderFooterSettings.maFooterText = aPlaceHolderString;
1465 break;
1466 case 3 :
1468 rHeaderFooterSettings.mbSlideNumberVisible = bVisible;
1470 break;
1472 pPage->setHeaderFooterSettings( rHeaderFooterSettings );
1477 // Import of pages
1478 struct Ppt97AnimationStlSortHelper
1480 bool operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 );
1483 bool Ppt97AnimationStlSortHelper::operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 )
1485 if( !p1.second.get() || !p2.second.get() )
1486 return true;
1487 if( *p1.second < *p2.second )
1488 return true;
1489 if( *p1.second > *p2.second )
1490 return false;
1491 if( p1.first->GetOrdNum() < p2.first->GetOrdNum() )
1492 return true;
1493 return false;
1496 void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimationsUsed )
1498 sal_uLong nFilePosMerk = rStCtrl.Tell();
1500 // set PageKind at page (up to now only PK_STANDARD or PK_NOTES)
1501 if ( pPage->GetPageKind() == PK_STANDARD )
1503 PptSlidePersistList* pPersistList = GetPageList( eAktPageKind );
1504 PptSlidePersistEntry* pActualSlidePersist = ( pPersistList && ( nAktPageNum < pPersistList->size() ) )
1505 ? &(*pPersistList)[ nAktPageNum ] : NULL;
1507 if ( pActualSlidePersist && ( eAktPageKind == PPT_SLIDEPAGE ) )
1509 if ( ! ( pActualSlidePersist->aSlideAtom.nFlags & 1 ) ) // do not follow master objects ?
1511 if(pPage->TRG_HasMasterPage())
1513 SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1514 aVisibleLayers.Set(mnBackgroundObjectsLayerID, false);
1515 pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
1519 DffRecordHeader aPageRecHd;
1520 if ( SeekToAktPage( &aPageRecHd ) )
1522 sal_uLong nPageRecEnd = SanitizeEndPos(rStCtrl, aPageRecHd.GetRecEndFilePos());
1524 bool bTryTwice = ( eAktPageKind == PPT_SLIDEPAGE );
1525 bool bSSSlideInfoAtom = false;
1526 while ( true )
1528 while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nPageRecEnd ) )
1530 DffRecordHeader aHd;
1531 ReadDffRecordHeader( rStCtrl, aHd );
1532 switch ( aHd.nRecType )
1534 case PPT_PST_SSSlideInfoAtom:
1536 bSSSlideInfoAtom = true;
1537 if ( eAktPageKind == PPT_MASTERPAGE )
1539 if ( pActualSlidePersist )
1540 pActualSlidePersist->aPersistAtom.nReserved = aHd.GetRecBegFilePos();
1542 else
1544 sal_Int8 nDirection, nTransitionType, nByteDummy, nSpeed;
1545 sal_Int16 nBuildFlags;
1546 sal_Int32 nSlideTime, nSoundRef;
1547 rStCtrl.ReadInt32( nSlideTime ) // time to show (in Ticks)
1548 .ReadInt32( nSoundRef ) // Index of SoundCollection
1549 .ReadSChar( nDirection ) // direction of fade effect
1550 .ReadSChar( nTransitionType ) // fade effect
1551 .ReadInt16( nBuildFlags ) // Buildflags (s.u.)
1552 .ReadSChar( nSpeed ) // speed (slow, medium, fast)
1553 .ReadSChar( nByteDummy ).ReadSChar( nByteDummy ).ReadSChar( nByteDummy );
1555 switch ( nTransitionType )
1557 case PPT_TRANSITION_TYPE_BLINDS :
1559 if ( nDirection == 0 )
1560 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES ); // fade vertical
1561 else if ( nDirection == 1 )
1562 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES ); // fade horizontal
1564 break;
1565 case PPT_TRANSITION_TYPE_CHECKER :
1567 if ( nDirection == 0 )
1568 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD ); // fade vertical with offset ??
1569 else if ( nDirection == 1 )
1570 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD ); // fade horizontal with offset ??
1572 break;
1573 case PPT_TRANSITION_TYPE_COVER :
1575 if ( nDirection == 0 )
1576 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT ); // overlay from right
1577 else if ( nDirection == 1 )
1578 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM ); // overlay from bottom
1579 else if ( nDirection == 2 )
1580 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT ); // overlay from left
1581 else if ( nDirection == 3 )
1582 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP ); // overlay from top
1583 else if ( nDirection == 4 )
1584 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT ); // overlay from bottom right ??
1585 else if ( nDirection == 5 )
1586 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT ); // overlay from bottom left ??
1587 else if ( nDirection == 6 )
1588 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT ); // overlay from top right
1589 else if ( nDirection == 7 )
1590 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT ); // overlay from top left ??
1592 break;
1593 case PPT_TRANSITION_TYPE_NONE :
1595 if ( nBuildFlags )
1597 if ( nDirection == 0 )
1598 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_NONE ); // direct
1599 else if ( nDirection == 1 )
1601 pPage->setTransitionType( animations::TransitionType::BARWIPE );
1602 pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
1603 pPage->setTransitionFadeColor( 0 );
1606 else
1607 pPage->setTransitionType( 0 );
1609 break;
1610 case PPT_TRANSITION_TYPE_DISSOLVE :
1611 pPage->SetFadeEffect(::com::sun::star::presentation::FadeEffect_DISSOLVE); // dissolve
1612 break;
1613 case PPT_TRANSITION_TYPE_RANDOM_BARS :
1615 if ( nDirection == 0 )
1616 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES ); // horizontal lines
1617 else if ( nDirection == 1 )
1618 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES ); // vertical lines
1620 break;
1621 case PPT_TRANSITION_TYPE_SPLIT :
1623 if ( nDirection == 0 )
1624 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL ); // open horizontal ??
1625 else if ( nDirection == 1 )
1626 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL ); // close horizontal ??
1627 else if ( nDirection == 2 )
1628 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL ); // open vertical ??
1629 else if ( nDirection == 3 )
1630 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL ); // close vertical ??
1632 break;
1633 case PPT_TRANSITION_TYPE_STRIPS :
1635 if ( nDirection == 4 )
1636 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT ); // diagonal to top left
1637 else if ( nDirection == 5 )
1638 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT ); // diagonal to top right
1639 else if ( nDirection == 6 )
1640 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT ); // diagonal to bottom left
1641 else if ( nDirection == 7 )
1642 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT ); // diagonal to bottom right
1644 break;
1645 case PPT_TRANSITION_TYPE_PULL :
1647 if ( nDirection == 0 )
1648 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT ); // uncover to left
1649 else if ( nDirection == 1 )
1650 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP ); // uncover to top
1651 else if ( nDirection == 2 )
1652 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT ); // uncover to right
1653 else if ( nDirection == 3 )
1654 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM ); // uncover to bottom
1655 else if ( nDirection == 4 )
1656 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT ); // uncover to top left
1657 else if ( nDirection == 5 )
1658 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT ); // uncover to top right
1659 else if ( nDirection == 6 )
1660 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT ); // uncover to bottom left
1661 else if ( nDirection == 7 )
1662 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT ); // uncover to bottom right
1664 break;
1665 case PPT_TRANSITION_TYPE_WIPE :
1667 if ( nDirection == 0 )
1668 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT ); // roll from right
1669 else if ( nDirection == 1 )
1670 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM ); // roll from bottom
1671 else if ( nDirection == 2 )
1672 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT ); // roll from left
1673 else if ( nDirection == 3 )
1674 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP ); // roll from top
1676 break;
1677 case PPT_TRANSITION_TYPE_RANDOM :
1678 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_RANDOM ); // automatic
1679 break;
1680 case PPT_TRANSITION_TYPE_FADE :
1682 pPage->setTransitionType( animations::TransitionType::FADE );
1683 pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
1684 pPage->setTransitionFadeColor( 0 );
1686 break;
1687 case PPT_TRANSITION_TYPE_ZOOM :
1689 if ( nDirection == 0 )
1690 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER ); // fade from center
1691 else if ( nDirection == 1 )
1692 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER ); // fade from the outside
1694 break;
1695 case PPT_TRANSITION_TYPE_DIAMOND :
1697 pPage->setTransitionType( animations::TransitionType::IRISWIPE );
1698 pPage->setTransitionSubtype( animations::TransitionSubType::DIAMOND );
1700 break;
1701 case PPT_TRANSITION_TYPE_PLUS :
1703 pPage->setTransitionType( animations::TransitionType::FOURBOXWIPE );
1704 pPage->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT );
1706 break;
1707 case PPT_TRANSITION_TYPE_CIRCLE :
1709 pPage->setTransitionType( animations::TransitionType::ELLIPSEWIPE );
1710 pPage->setTransitionSubtype( animations::TransitionSubType::CIRCLE );
1712 break;
1713 case PPT_TRANSITION_TYPE_WEDGE :
1715 pPage->setTransitionType( animations::TransitionType::FANWIPE );
1716 pPage->setTransitionSubtype( animations::TransitionSubType::CENTERTOP );
1718 break;
1719 case PPT_TRANSITION_TYPE_WHEEL :
1721 pPage->setTransitionType( animations::TransitionType::PINWHEELWIPE );
1722 sal_Int16 nSubType;
1723 switch( nDirection )
1725 default:
1726 case 1 : nSubType = animations::TransitionSubType::ONEBLADE; break;
1727 case 2 : nSubType = animations::TransitionSubType::TWOBLADEVERTICAL; break;
1728 case 3 : nSubType = animations::TransitionSubType::THREEBLADE; break;
1729 case 4 : nSubType = animations::TransitionSubType::FOURBLADE; break;
1730 case 8 : nSubType = animations::TransitionSubType::EIGHTBLADE; break;
1732 pPage->setTransitionSubtype( nSubType );
1734 break;
1735 case PPT_TRANSITION_TYPE_PUSH :
1737 pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
1738 sal_Int16 nSubType;
1739 switch( nDirection )
1741 default:
1742 case 0 : nSubType = animations::TransitionSubType::FROMRIGHT; break;
1743 case 1 : nSubType = animations::TransitionSubType::FROMBOTTOM; break;
1744 case 2 : nSubType = animations::TransitionSubType::FROMLEFT; break;
1745 case 3 : nSubType = animations::TransitionSubType::FROMTOP; break;
1747 pPage->setTransitionSubtype( nSubType );
1749 break;
1750 case PPT_TRANSITION_TYPE_COMB :
1752 pPage->setTransitionType( animations::TransitionType::PUSHWIPE );
1753 pPage->setTransitionSubtype( nDirection ? animations::TransitionSubType::COMBVERTICAL : animations::TransitionSubType::COMBHORIZONTAL );
1755 break;
1756 case PPT_TRANSITION_TYPE_NEWSFLASH :
1758 pPage->setTransitionType( animations::TransitionType::ZOOM );
1759 pPage->setTransitionSubtype( animations::TransitionSubType::ROTATEIN );
1761 break;
1762 case PPT_TRANSITION_TYPE_SMOOTHFADE :
1764 pPage->setTransitionType( animations::TransitionType::FADE );
1765 pPage->setTransitionSubtype( animations::TransitionSubType::CROSSFADE );
1767 break;
1770 if ( nSpeed == 0 )
1771 pPage->setTransitionDuration( 3.0 ); // slow
1772 else if ( nSpeed == 1 )
1773 pPage->setTransitionDuration( 2.0 ); // medium
1774 else if ( nSpeed == 2 )
1775 pPage->setTransitionDuration( 1.0 ); // fast
1777 if ( nBuildFlags & 0x400 ) // slidechange by time
1778 { // time to show (in Ticks)
1779 pPage->SetPresChange( PRESCHANGE_AUTO );
1780 pPage->SetTime( nSlideTime / 1000.0 );
1782 else
1783 pPage->SetPresChange( mePresChange );
1785 if ( nBuildFlags & 4 )
1786 pPage->SetExcluded( true ); // don't show slide
1787 if ( nBuildFlags & 16 )
1788 { // slide with sound effect
1789 pPage->SetSound( true );
1790 OUString aSoundFile( ReadSound( nSoundRef ) );
1791 pPage->SetSoundFile( aSoundFile );
1793 if ( nBuildFlags & ( 1 << 6 ) ) // Loop until next sound
1794 pPage->SetLoopSound( true );
1795 if ( nBuildFlags & ( 1 << 8 ) ) // Stop the previous sound
1796 pPage->SetStopSound( true );
1797 break;
1801 if (!aHd.SeekToEndOfRecord(rStCtrl))
1802 break;
1804 if ( bTryTwice && !bSSSlideInfoAtom )
1806 bTryTwice = false;
1807 if ( HasMasterPage( nAktPageNum, eAktPageKind ) )
1809 sal_uInt16 nMasterNum = GetMasterPageIndex( nAktPageNum, eAktPageKind );
1810 PptSlidePersistList* pPageList = GetPageList( PPT_MASTERPAGE );
1811 if ( pPageList && ( nMasterNum < pPageList->size() ) )
1813 assert( !pPageList->is_null( nMasterNum ) );
1814 const PptSlidePersistEntry& rE = (*pPageList)[ nMasterNum ];
1815 sal_uInt32 nOfs = rE.aPersistAtom.nReserved;
1816 if ( nOfs )
1818 rStCtrl.Seek( nOfs );
1819 nPageRecEnd = nOfs + 16;
1820 continue;
1826 break;
1831 if ( !bNewAnimationsUsed )
1833 tAnimationVector aAnimationsOnThisPage;
1835 // add effects from page in correct order
1836 SdrObjListIter aSdrIter( *pPage, IM_FLAT );
1837 while ( aSdrIter.IsMore() )
1839 SdrObject* pObj = aSdrIter.Next();
1840 tAnimationMap::iterator aFound = maAnimations.find( pObj );
1841 if( aFound != maAnimations.end() )
1843 std::pair< SdrObject*, Ppt97AnimationPtr > aPair( (*aFound).first, (*aFound).second );
1844 aAnimationsOnThisPage.push_back( aPair );
1848 Ppt97AnimationStlSortHelper aSortHelper;
1849 std::sort( aAnimationsOnThisPage.begin(), aAnimationsOnThisPage.end(), aSortHelper );
1851 tAnimationVector::iterator aIter( aAnimationsOnThisPage.begin() );
1852 const tAnimationVector::iterator aEnd( aAnimationsOnThisPage.end() );
1854 for( ;aIter != aEnd; ++aIter )
1856 Ppt97AnimationPtr pPpt97Animation = (*aIter).second;;
1857 if( pPpt97Animation.get() )
1858 pPpt97Animation->createAndSetCustomAnimationEffect( (*aIter).first );
1861 rStCtrl.Seek( nFilePosMerk );
1864 // import of sounds
1866 // Not only the sounds are imported as string, they are also inserted to
1867 // the gallery if they are not already there.
1868 OUString ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const
1870 OUString aRetval;
1871 sal_uInt32 nPosMerk = rStCtrl.Tell();
1872 DffRecordHeader aDocHd;
1873 if ( SeekToDocument( &aDocHd ) )
1875 sal_uInt32 nSoundLen = aDocHd.GetRecEndFilePos();
1876 DffRecordHeader aSoundBlockRecHd;
1877 if( SeekToRec( rStCtrl, PPT_PST_SoundCollection, nSoundLen, &aSoundBlockRecHd ) )
1879 sal_uInt32 nDataLen = aSoundBlockRecHd.GetRecEndFilePos();
1880 DffRecordHeader aSoundRecHd;
1881 bool bRefStrValid = false;
1882 bool bDone = false;
1884 while( !bDone && SeekToRec( rStCtrl, PPT_PST_Sound, nDataLen, &aSoundRecHd ) )
1886 sal_uInt32 nStrLen = aSoundRecHd.GetRecEndFilePos();
1887 OUString aRefStr;
1888 sal_uInt32 nPosMerk2 = rStCtrl.Tell();
1889 if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 2 ) )
1891 if ( ReadString( aRefStr ) )
1892 bRefStrValid = true;
1894 if ( bRefStrValid )
1896 if ( OUString::number(nSoundRef) == aRefStr )
1898 rStCtrl.Seek( nPosMerk2 );
1899 if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen, NULL, 0 ) )
1901 ReadString( aRetval );
1902 bDone = true;
1906 if ( bDone )
1908 // Check if this sound file already exists.
1909 // If not, it is exported to our local sound directory.
1910 bool bSoundExists = false;
1911 ::std::vector< OUString > aSoundList;
1913 GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, aSoundList );
1914 GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, aSoundList );
1916 for( size_t n = 0; ( n < aSoundList.size() ) && !bSoundExists; ++n )
1918 INetURLObject aURL( aSoundList[ n ] );
1920 if( aURL.GetName() == aRetval )
1922 aRetval = aSoundList[ n ];
1923 bSoundExists = true;
1927 aSoundList.clear();
1929 if ( !bSoundExists )
1931 rStCtrl.Seek( nPosMerk2 );
1932 DffRecordHeader aSoundDataRecHd;
1933 if ( SeekToRec( rStCtrl, PPT_PST_SoundData, nStrLen, &aSoundDataRecHd, 0 ) )
1935 OUString aGalleryDir( SvtPathOptions().GetGalleryPath() );
1936 sal_Int32 nTokenCount = comphelper::string::getTokenCount(aGalleryDir, ';');
1937 INetURLObject aGalleryUserSound( aGalleryDir.getToken( nTokenCount - 1, ';' ) );
1939 aGalleryUserSound.Append( aRetval );
1940 sal_uInt32 nSoundDataLen = aSoundDataRecHd.nRecLen;
1941 sal_uInt8* pBuf = new sal_uInt8[ nSoundDataLen ];
1943 rStCtrl.Read( pBuf, nSoundDataLen );
1944 SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::WRITE | StreamMode::TRUNC );
1946 if( pOStm )
1948 pOStm->Write( pBuf, nSoundDataLen );
1950 if( pOStm->GetError() == ERRCODE_NONE )
1952 GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ) );
1953 aRetval = aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE );
1956 delete pOStm;
1959 delete[] pBuf;
1963 if ( !bDone )
1965 if (!aSoundRecHd.SeekToEndOfRecord(rStCtrl))
1966 break;
1971 rStCtrl.Seek( nPosMerk );
1972 return aRetval;
1975 // media object import, the return value is the url to the media object
1976 OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
1978 OUString aRetVal;
1979 DffRecordHeader* pHd( const_cast<ImplSdPPTImport*>(this)->aDocRecManager.GetRecordHeader( PPT_PST_ExObjList, SEEK_FROM_BEGINNING ) );
1980 if ( pHd )
1982 pHd->SeekToContent( rStCtrl );
1983 auto nEndRecPos = SanitizeEndPos(rStCtrl, pHd->GetRecEndFilePos());
1984 while ( ( rStCtrl.Tell() < nEndRecPos ) && aRetVal.isEmpty() )
1986 DffRecordHeader aHdMovie;
1987 ReadDffRecordHeader( rStCtrl, aHdMovie );
1988 switch( aHdMovie.nRecType )
1990 case PPT_PST_ExAviMovie :
1991 case PPT_PST_ExMCIMovie :
1993 DffRecordHeader aExVideoHd;
1994 if ( SeekToRec( rStCtrl, PPT_PST_ExVideo, aHdMovie.GetRecEndFilePos(), &aExVideoHd ) )
1996 DffRecordHeader aExMediaAtomHd;
1997 if ( SeekToRec( rStCtrl, PPT_PST_ExMediaAtom, aExVideoHd.GetRecEndFilePos(), &aExMediaAtomHd ) )
1999 sal_uInt32 nRef;
2000 rStCtrl.ReadUInt32( nRef );
2001 if ( nRef == nMediaRef )
2003 aExVideoHd.SeekToContent( rStCtrl );
2004 auto nHdEndRecPos = SanitizeEndPos(rStCtrl, aExVideoHd.GetRecEndFilePos());
2005 while (rStCtrl.Tell() < nHdEndRecPos)
2007 DffRecordHeader aHd;
2008 ReadDffRecordHeader( rStCtrl, aHd );
2009 switch( aHd.nRecType )
2011 case PPT_PST_CString :
2013 aHd.SeekToBegOfRecord( rStCtrl );
2014 OUString aStr;
2015 if ( ReadString( aStr ) )
2017 if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aStr, aRetVal ) )
2019 aRetVal = INetURLObject( aRetVal ).GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
2020 }else{
2021 aRetVal = aStr;
2025 break;
2027 if (!aHd.SeekToEndOfRecord(rStCtrl))
2028 break;
2030 break;
2035 break;
2037 if (!aHdMovie.SeekToEndOfRecord(rStCtrl))
2038 break;
2041 return aRetVal;
2044 // import of objects
2045 void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, const OUString& aMacroName )
2047 // set local information into pInfo
2048 if( pIAtom->nSoundRef )
2050 pInfo->SetBookmark( ReadSound( pIAtom->nSoundRef ) ); // path to sound file in MS DOS notation
2051 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_SOUND; // RunProgramAction
2054 switch ( pIAtom->nAction )
2057 case 0x02 : // RunProgramAction
2059 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
2060 pInfo->SetBookmark( aMacroName ); // program name in aBookmark
2062 break;
2063 case 0x03 : // JumpAction
2065 switch( pIAtom->nJump )
2067 case 0x01 :
2068 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NEXTPAGE; // Next slide
2069 break;
2070 case 0x02 :
2071 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Previous slide
2072 break;
2073 case 0x03 :
2074 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_FIRSTPAGE; // First slide
2075 break;
2076 case 0x04 :
2077 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_LASTPAGE; // last Slide
2078 break;
2079 case 0x05 :
2080 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PREVPAGE; // Last slide viewed
2081 break;
2082 case 0x06 :
2083 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_STOPPRESENTATION; // End show
2084 break;
2085 default :
2086 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_NONE; // 0x00: no action, else unknown
2087 break;
2090 break;
2091 case 0x04 :
2093 SdHyperlinkEntry* pPtr = NULL;
2094 for ( size_t i = 0, n = aHyperList.size(); i < n; ++i ) {
2095 if ( aHyperList[ i ]->nIndex == pIAtom->nExHyperlinkId ) {
2096 pPtr = aHyperList[ i ];
2097 break;
2100 if ( pPtr )
2102 switch( pIAtom->nHyperlinkType )
2104 case 9:
2105 case 8: // hyperlink : URL
2107 if ( !pPtr->aTarget.isEmpty() )
2109 ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
2110 if ( pDocShell )
2112 OUString aBaseURL = pDocShell->GetMedium()->GetBaseURL();
2113 OUString aBookmarkURL( pInfo->GetBookmark() );
2114 INetURLObject aURL( pPtr->aTarget );
2115 if( INetProtocol::NotValid == aURL.GetProtocol() )
2116 utl::LocalFileHelper::ConvertSystemPathToURL( pPtr->aTarget, aBaseURL, aBookmarkURL );
2117 if( aBookmarkURL.isEmpty() )
2118 aBookmarkURL = URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pPtr->aTarget, URIHelper::GetMaybeFileHdl(), true );
2119 pInfo->SetBookmark( aBookmarkURL );
2120 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_PROGRAM;
2124 break;
2126 case 10:
2127 break;
2129 case 7: // hyperlink to a page
2131 if ( !pPtr->aConvSubString.isEmpty() )
2133 pInfo->meClickAction = ::com::sun::star::presentation::ClickAction_BOOKMARK;
2134 pInfo->SetBookmark( pPtr->aConvSubString );
2137 break;
2141 break;
2142 case 0x05 : // OLEAction ( OLEVerb to use, 0==first, 1==second, .. )
2143 case 0x06 : // MediaAction
2144 case 0x07 : // CustomShowAction
2145 default : // 0x00: no action, else unknown action
2146 break;
2150 SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj, SdPageCapsule pPageCapsule,
2151 SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
2153 SdPage * pPage = static_cast<SdPage *>(pPageCapsule.page);
2154 SfxStyleSheet* pStyleSheetAry[ 9 ];
2155 SdrTextObj* pText = pObj;
2156 SdrObject* pRet = pText;
2158 ppStyleSheetAry = NULL;
2160 PresObjKind ePresKind = PRESOBJ_NONE;
2161 PptOEPlaceholderAtom* pPlaceHolder = pTextObj->GetOEPlaceHolderAtom();
2162 OUString aPresentationText;
2163 if ( pPlaceHolder )
2165 switch( pPlaceHolder->nPlaceholderId )
2167 case PptPlaceholder::MASTERNOTESSLIDEIMAGE :
2168 case PptPlaceholder::MASTERCENTEREDTITLE :
2169 case PptPlaceholder::MASTERTITLE :
2171 ePresKind = PRESOBJ_TITLE;
2172 aPresentationText = pPage->GetPresObjText( ePresKind );
2174 break;
2175 case PptPlaceholder::MASTERBODY :
2177 ePresKind = PRESOBJ_OUTLINE;
2178 aPresentationText = pPage->GetPresObjText( ePresKind );
2180 break;
2181 case PptPlaceholder::MASTERSUBTITLE :
2183 ePresKind = PRESOBJ_TEXT;
2184 aPresentationText = pPage->GetPresObjText( ePresKind );
2186 break;
2187 case PptPlaceholder::MASTERNOTESBODYIMAGE :
2189 ePresKind = PRESOBJ_NOTES;
2190 aPresentationText = pPage->GetPresObjText( ePresKind );
2192 break;
2193 case PptPlaceholder::MASTERDATE : ePresKind = PRESOBJ_DATETIME; break;
2194 case PptPlaceholder::MASTERSLIDENUMBER : ePresKind = PRESOBJ_SLIDENUMBER;break;
2195 case PptPlaceholder::MASTERFOOTER : ePresKind = PRESOBJ_FOOTER; break;
2196 case PptPlaceholder::MASTERHEADER : ePresKind = PRESOBJ_HEADER; break;
2197 default: break;
2200 switch ( pTextObj->GetDestinationInstance() )
2202 case TSS_TYPE_PAGETITLE :
2203 case TSS_TYPE_TITLE :
2205 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2206 if ( pSheet )
2207 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, true );
2208 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2210 break;
2211 case TSS_TYPE_SUBTITLE :
2213 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
2214 if ( pSheet )
2215 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, true );
2216 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" );
2218 break;
2219 case TSS_TYPE_BODY :
2220 case TSS_TYPE_HALFBODY :
2221 case TSS_TYPE_QUARTERBODY :
2223 for ( sal_uInt16 nLevel = 9; nLevel; nLevel-- )
2225 OUString aName( pPage->GetLayoutName() );
2226 aName += " ";
2227 aName += OUString::number( nLevel );
2228 pSheet = static_cast<SfxStyleSheet*>(mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE ));
2229 if ( pSheet )
2230 pText->StartListening( *pSheet );
2231 pStyleSheetAry[ nLevel - 1 ] = pSheet;
2233 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for outlinerobject (SJ)" );
2234 if ( pSheet )
2235 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, true );
2236 ppStyleSheetAry = &pStyleSheetAry[ 0 ];
2238 break;
2239 case TSS_TYPE_NOTES :
2241 if ( pPlaceHolder && ( ( pPlaceHolder->nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE )
2242 || ( pPlaceHolder->nPlaceholderId == PptPlaceholder::MASTERNOTESSLIDEIMAGE ) ) )
2244 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2245 if ( pSheet )
2246 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, true );
2247 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2249 else
2251 pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_NOTES );
2252 DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for notesobj (SJ)" );
2253 if ( pSheet )
2254 ((SdrAttrObj*)pText)->SdrAttrObj::NbcSetStyleSheet( pSheet, true );
2257 break;
2258 case TSS_TYPE_UNUSED :
2259 case TSS_TYPE_TEXT_IN_SHAPE :
2261 switch( ePresKind )
2263 case PRESOBJ_DATETIME :
2264 case PRESOBJ_SLIDENUMBER :
2265 case PRESOBJ_FOOTER :
2266 case PRESOBJ_HEADER :
2267 pSheet = static_cast<SfxStyleSheet*>(mpDoc->GetStyleSheetPool()->Find(SD_RESSTR(STR_PSEUDOSHEET_BACKGROUNDOBJECTS), SD_STYLE_FAMILY_PSEUDO ));
2268 break;
2269 default :
2270 pSheet = static_cast<SfxStyleSheet*>(mpDoc->GetStyleSheetPool()->Find(SD_RESSTR(STR_STANDARD_STYLESHEET_NAME), SD_STYLE_FAMILY_GRAPHICS ));
2273 break;
2275 pText = static_cast<SdrTextObj*>(SdrPowerPointImport::ApplyTextObj( pTextObj, pText, pPageCapsule, pSheet, ppStyleSheetAry ));
2276 if ( pPlaceHolder && pPlaceHolder->nPlaceholderId != PptPlaceholder::NONE )
2278 if ( eAktPageKind == PPT_MASTERPAGE )
2280 bool bCreatePlaceHolder = ( pTextObj->GetInstance() != TSS_TYPE_UNUSED );
2281 bool bIsHeaderFooter = ( ePresKind == PRESOBJ_HEADER) || (ePresKind == PRESOBJ_FOOTER)
2282 || (ePresKind == PRESOBJ_DATETIME) || (ePresKind == PRESOBJ_SLIDENUMBER);
2283 if ( bCreatePlaceHolder && ( pTextObj->GetInstance() == TSS_TYPE_TEXT_IN_SHAPE ) )
2284 bCreatePlaceHolder = bIsHeaderFooter;
2285 if ( bCreatePlaceHolder )
2287 if ( !bIsHeaderFooter )
2289 pText->SetNotVisibleAsMaster( true );
2290 pText->SetEmptyPresObj( true );
2292 pText->SetUserCall( pPage );
2293 pPage->InsertPresObj( pText, ePresKind );
2294 SdrOutliner* pOutl = NULL;
2295 if ( pTextObj->GetInstance() == TSS_TYPE_NOTES )
2296 pOutl = GetDrawOutliner( pText );
2297 if ( !aPresentationText.isEmpty() )
2298 pPage->SetObjText( pText, pOutl, ePresKind, aPresentationText );
2300 if ( pPage->GetPageKind() != PK_NOTES && pPage->GetPageKind() != PK_HANDOUT)
2302 SfxStyleSheet* pSheet2( pPage->GetStyleSheetForPresObj( ePresKind ) );
2303 if ( pSheet2 )
2305 SfxItemSet& rItemSet = pSheet2->GetItemSet();
2306 rItemSet.Put( static_cast<const SdrMetricItem&>(pText->GetMergedItem( SDRATTR_TEXT_LEFTDIST ) ) );
2307 rItemSet.Put( static_cast<const SdrMetricItem&>(pText->GetMergedItem( SDRATTR_TEXT_RIGHTDIST )) );
2308 rItemSet.Put( static_cast<const SdrMetricItem&>(pText->GetMergedItem( SDRATTR_TEXT_UPPERDIST )) );
2309 rItemSet.Put( static_cast<const SdrMetricItem&>(pText->GetMergedItem( SDRATTR_TEXT_LOWERDIST )) );
2310 rItemSet.Put( static_cast<const SdrTextVertAdjustItem&>(pText->GetMergedItem( SDRATTR_TEXT_VERTADJUST )) );
2311 rItemSet.Put( static_cast<const SdrTextHorzAdjustItem&>(pText->GetMergedItem( SDRATTR_TEXT_HORZADJUST )) );
2312 if ( pTextObj->GetInstance() == TSS_TYPE_TITLE
2313 || pTextObj->GetInstance() == TSS_TYPE_SUBTITLE)
2315 rItemSet.Put( pText->GetMergedItemSet() );
2318 pText->NbcSetStyleSheet( pSheet2, false );
2321 SfxItemSet aTempAttr( mpDoc->GetPool() );
2322 SdrMetricItem aMinHeight( makeSdrTextMinFrameHeightItem(pText->GetLogicRect().GetSize().Height()) );
2323 aTempAttr.Put( aMinHeight );
2324 SdrOnOffItem aAutoGrowHeight( makeSdrTextAutoGrowHeightItem(false) );
2325 aTempAttr.Put( aAutoGrowHeight );
2326 pText->SetMergedItemSet(aTempAttr);
2328 else
2330 pRet = NULL;
2333 else
2335 const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
2336 if ( pSlideLayout || ( eAktPageKind == PPT_NOTEPAGE ) )
2338 sal_uInt32 nPlacementId = pPlaceHolder->nPlacementId;
2339 PptPlaceholder nPlaceholderId = pPlaceHolder->nPlaceholderId;
2341 if ( eAktPageKind == PPT_SLIDEPAGE )
2343 PresObjKind ePresObjKind = PRESOBJ_NONE;
2344 bool bEmptyPresObj = true;
2345 bool bVertical = false;
2346 if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
2348 //if a placeholder with some custom attribute,the pTextObj will keep those attr,whose text size is zero,
2349 //so sdPage should renew a PresObj to process placeholder.
2350 bEmptyPresObj = ( pTextObj->Count() == 0 ) || ( pTextObj->Count() == 1 && pTextObj->First()->GetTextSize() == 0 );
2351 switch ( nPlaceholderId )
2353 case PptPlaceholder::NOTESBODY : ePresObjKind = PRESOBJ_NOTES; break;
2354 case PptPlaceholder::VERTICALTEXTTITLE :
2355 bVertical = true; // PASSTHROUGH !!!
2356 case PptPlaceholder::TITLE : ePresObjKind = PRESOBJ_TITLE; break;
2357 case PptPlaceholder::VERTICALTEXTBODY :
2358 bVertical = true; // PASSTHROUGH !!!
2359 case PptPlaceholder::BODY : ePresObjKind = PRESOBJ_OUTLINE; break;
2360 case PptPlaceholder::CENTEREDTITLE : ePresObjKind = PRESOBJ_TITLE; break;
2361 case PptPlaceholder::SUBTITLE : ePresObjKind = PRESOBJ_TEXT; break; // PRESOBJ_OUTLINE
2363 default :
2365 if ( pTextObj->Count() == 0 )
2367 switch ( nPlaceholderId )
2369 case PptPlaceholder::MEDIACLIP :
2370 case PptPlaceholder::OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
2371 case PptPlaceholder::GRAPH : ePresObjKind = PRESOBJ_CHART; break;
2372 case PptPlaceholder::TABLE : ePresObjKind = PRESOBJ_TABLE; break;
2373 case PptPlaceholder::CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
2374 case PptPlaceholder::ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
2375 default: break;
2381 else if ( pTextObj->GetShapeType() == mso_sptPictureFrame )
2383 if ( !pTextObj->Count() && pObj->ISA( SdrGrafObj ) )
2385 bEmptyPresObj = false;
2386 switch ( nPlaceholderId )
2388 case PptPlaceholder::MEDIACLIP :
2389 case PptPlaceholder::OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
2390 case PptPlaceholder::GRAPH : ePresObjKind = PRESOBJ_CHART; break;
2391 case PptPlaceholder::TABLE : ePresObjKind = PRESOBJ_CALC; break;
2392 case PptPlaceholder::CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
2393 case PptPlaceholder::ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
2394 default: break;
2398 if ( ePresObjKind != PRESOBJ_NONE )
2400 if ( !bEmptyPresObj )
2402 pPage->InsertPresObj( pRet, ePresObjKind );
2404 else
2406 SdrObject* pPresObj = pPage->CreatePresObj( ePresObjKind, bVertical, pText->GetLogicRect(), true );
2407 pPresObj->SetUserCall( pPage );
2409 SfxItemSet aSet( pSdrModel->GetItemPool() );
2410 ApplyAttributes( rStCtrl, aSet );
2411 pPresObj->SetLogicRect(pText->GetLogicRect());
2412 ApplyTextAnchorAttributes( *pTextObj, aSet );
2413 //set custom font attribute of the placeholder
2414 if ( pTextObj->Count() == 1 )
2416 PPTParagraphObj* pPara = pTextObj->First();
2417 PPTPortionObj* pPor = NULL;
2418 if ( pPara && pPara->GetTextSize() == 0 && (pPor = pPara->First()))
2420 pPor->ApplyTo(aSet, (SdrPowerPointImport&)*this, pTextObj->GetDestinationInstance());
2423 pPresObj->SetMergedItemSet(aSet);
2425 if ((eAktPageKind != PPT_NOTEPAGE) && (nPlacementId != 0xffffffff) && pPage->TRG_HasMasterPage())
2427 SdrObject* pTitleObj = static_cast<SdPage&>(pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
2428 SdrObject* pOutlineObj = static_cast<SdPage&>(pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
2430 Rectangle aTitleRect;
2431 Rectangle aOutlineRect;
2432 Size aOutlineSize;
2434 if ( pTitleObj )
2435 aTitleRect = pTitleObj->GetLogicRect();
2436 if ( pOutlineObj )
2438 aOutlineRect = pOutlineObj->GetLogicRect();
2439 aOutlineSize = aOutlineRect.GetSize();
2441 Rectangle aLogicRect( pPresObj->GetLogicRect() );
2442 Size aLogicSize( aLogicRect.GetSize() );
2444 switch ( nPlacementId )
2446 case 0 : // position in title area
2448 if ( aLogicRect != aTitleRect )
2449 pPresObj->SetUserCall( NULL );
2451 break;
2453 case 1:
2455 if ( pSlideLayout->eLayout == PptSlideLayout::TITLEANDBODYSLIDE )
2456 { // position in outline area
2457 if ( aLogicRect != aOutlineRect )
2458 pPresObj->SetUserCall( NULL );
2460 else if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
2461 { // position in outline area left
2462 if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2463 std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2464 std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2465 (double)aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
2466 (double)aLogicSize.Width() / aOutlineSize.Width() > 0.5)
2468 pPresObj->SetUserCall(NULL);
2471 else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
2472 { // position in outline area top
2473 if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2474 std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2475 std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
2477 pPresObj->SetUserCall( NULL );
2480 else if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2481 std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
2482 { // position in outline area top left
2483 pPresObj->SetUserCall( NULL );
2486 break;
2488 case 2:
2490 if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
2491 { // position in outline area right
2492 if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2493 std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
2494 std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2495 (double)aLogicSize.Width() / aOutlineSize.Width() < 0.48 ||
2496 (double)aLogicSize.Width() / aOutlineSize.Width() > 0.5)
2498 pPresObj->SetUserCall( NULL );
2501 else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
2502 { // position in outline area bottom
2503 if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2504 std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||
2505 std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE)
2507 pPresObj->SetUserCall( NULL );
2510 else if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2511 std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE)
2512 { // position in outline area top right
2513 pPresObj->SetUserCall(NULL);
2516 break;
2518 case 3:
2519 { // position in outline area bottom left
2520 if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
2521 std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
2523 pPresObj->SetUserCall( NULL );
2526 break;
2528 case 4:
2529 { // position in outline area bottom right
2530 if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
2531 std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE)
2533 pObj->SetUserCall( NULL );
2536 break;
2539 pRet = NULL; // return zero cause this obj was already inserted by CreatePresObj
2542 else if ( !pTextObj->Count() )
2543 pRet = NULL;
2548 if ( pRet != pText )
2550 SdrObject* pFree( pText );
2551 SdrObject::Free( pFree );
2553 return pRet;
2556 SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, Rectangle& rTextRect, SdrObject* pRet )
2558 SdrObject* pObj = SdrPowerPointImport::ProcessObj( rSt, rObjData, pData, rTextRect, pRet );
2560 // read animation effect of object
2561 if ( pObj )
2563 // further setup placeholder objects
2564 if( pObj->ISA(SdrPageObj) && pData )
2566 const ProcessData* pProcessData=static_cast<const ProcessData*>(pData);
2567 if( pProcessData->pPage.page )
2568 static_cast<SdPage *>(pProcessData->pPage.page)->InsertPresObj(
2569 pObj, PRESOBJ_PAGE );
2572 DffRecordHeader aMasterShapeHd;
2574 if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
2576 bool bInhabitanceChecked = false;
2577 bool bAnimationInfoFound = false;
2579 DffRecordHeader& rHdClientData = *maShapeRecords.Current();
2580 while( true )
2582 sal_uInt32 nClientDataLen = SanitizeEndPos(rSt, rHdClientData.GetRecEndFilePos());
2583 DffRecordHeader aHd;
2586 ReadDffRecordHeader( rSt, aHd );
2587 sal_uInt32 nHdRecEnd = aHd.GetRecEndFilePos();
2588 switch ( aHd.nRecType )
2590 case PPT_PST_AnimationInfo :
2592 DffRecordHeader aHdAnimInfoAtom;
2593 if ( SeekToRec( rSt, PPT_PST_AnimationInfoAtom, nHdRecEnd, &aHdAnimInfoAtom ) )
2595 // read data from stream
2596 Ppt97AnimationPtr pAnimation( new Ppt97Animation( rSt ) );
2597 // store animation information
2598 if( pAnimation->HasEffect() )
2600 // translate color to RGB
2601 pAnimation->SetDimColor( MSO_CLR_ToColor(pAnimation->GetDimColor()).GetColor() );
2602 // translate sound bits to file url
2603 if( pAnimation->HasSoundEffect() )
2604 pAnimation->SetSoundFileUrl( ReadSound( pAnimation->GetSoundRef() ) );
2606 bool bDontAnimateInvisibleShape = false;
2608 SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
2610 if( pTextObj && pTextObj->HasText() &&
2611 !pObj->ISA( SdrObjGroup ) &&
2612 pAnimation->HasAnimateAssociatedShape() )
2614 const SfxItemSet& rObjItemSet = pObj->GetMergedItemSet();
2616 drawing::FillStyle eFillStyle = static_cast<const XFillStyleItem&>(rObjItemSet.Get(XATTR_FILLSTYLE)).GetValue();
2617 drawing::LineStyle eLineStyle = static_cast<const XLineStyleItem&>(rObjItemSet.Get(XATTR_LINESTYLE)).GetValue();
2619 if ( ( eFillStyle == drawing::FillStyle_NONE ) && ( eLineStyle == drawing::LineStyle_NONE ) )
2620 bDontAnimateInvisibleShape = true;
2623 if( bDontAnimateInvisibleShape )
2624 pAnimation->SetAnimateAssociatedShape(false);
2626 //maybe some actions necessary to ensure that animations on master pages are played before animations on normal pages
2627 ///mabe todo in future: bool bIsEffectOnMasterPage = !bInhabitanceChecked;?
2629 maAnimations[pObj] = pAnimation;
2631 bAnimationInfoFound = true;
2635 break;
2636 case PPT_PST_InteractiveInfo:
2638 sal_uInt32 nFilePosMerk2 = rSt.Tell();
2639 OUString aMacroName;
2641 if(SeekToRec( rSt, PPT_PST_CString, nHdRecEnd, NULL, 0 ) )
2642 ReadString(aMacroName);
2644 rSt.Seek( nFilePosMerk2 );
2645 DffRecordHeader aHdInteractiveInfoAtom;
2646 if ( SeekToRec( rSt, PPT_PST_InteractiveInfoAtom, nHdRecEnd, &aHdInteractiveInfoAtom ) )
2648 PptInteractiveInfoAtom aInteractiveInfoAtom;
2649 ReadPptInteractiveInfoAtom( rSt, aInteractiveInfoAtom );
2651 // interactive object
2652 SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
2654 FillSdAnimationInfo( pInfo, &aInteractiveInfoAtom, aMacroName );
2655 if ( aInteractiveInfoAtom.nAction == 6 ) // Sj -> media action
2657 rHdClientData.SeekToContent( rStCtrl );
2658 DffRecordHeader aObjRefAtomHd;
2659 if ( SeekToRec( rSt, PPT_PST_ExObjRefAtom, nHdRecEnd, &aObjRefAtomHd ) )
2661 sal_uInt32 nRef;
2662 rSt.ReadUInt32( nRef );
2663 OUString aMediaURL( ReadMedia( nRef ) );
2664 if ( aMediaURL.isEmpty() )
2665 aMediaURL = ReadSound( nRef );
2666 if ( !aMediaURL.isEmpty() )
2668 SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() );
2669 pMediaObj->SetModel( pObj->GetModel() );
2670 pMediaObj->SetMergedItemSet( pObj->GetMergedItemSet() );
2672 //--remove object from maAnimations list and add the new object instead
2673 Ppt97AnimationPtr pAnimation;
2675 tAnimationMap::iterator aFound = maAnimations.find( pObj );
2676 if( aFound != maAnimations.end() )
2678 pAnimation = (*aFound).second;
2679 maAnimations.erase(aFound);
2681 maAnimations[pMediaObj] = pAnimation;
2684 SdrObject::Free( pObj ), pObj = pMediaObj; // SJ: hoping that pObj is not inserted in any list
2685 pMediaObj->setURL( aMediaURL, ""/*TODO?*/ );
2691 break;
2693 if (!aHd.SeekToEndOfRecord(rSt))
2694 break;
2696 while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) );
2698 if ( bInhabitanceChecked || bAnimationInfoFound )
2699 break;
2700 bInhabitanceChecked = true;
2701 if ( ! ( IsProperty( DFF_Prop_hspMaster ) && SeekToShape( rSt, pData, GetPropertyValue( DFF_Prop_hspMaster ) ) ) )
2702 break;
2703 ReadDffRecordHeader( rSt, aMasterShapeHd );
2704 if ( !SeekToRec( rSt, DFF_msofbtClientData, aMasterShapeHd.GetRecEndFilePos(), &aMasterShapeHd ) )
2705 break;
2706 aMasterShapeHd.SeekToContent( rSt );
2707 rHdClientData = aMasterShapeHd;
2711 return pObj;
2714 bool
2715 ImplSdPPTImport::ReadFormControl( tools::SvRef<SotStorage>& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const
2717 uno::Reference< frame::XModel > xModel;
2718 if ( mpDoc->GetDocSh() )
2720 xModel = mpDoc->GetDocSh()->GetModel();
2721 oox::ole::MSConvertOCXControls mCtrlImporter( xModel );
2722 return mCtrlImporter.ReadOCXStorage( rSrc1, rFormComp );
2724 return false;
2727 // exported function
2728 extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL ImportPPT(
2729 SdDrawDocument* pDocument, SvStream& rDocStream, SotStorage& rStorage, SfxMedium& rMedium )
2731 SdPPTImport* pImport = new SdPPTImport( pDocument, rDocStream, rStorage, rMedium );
2732 bool bRet = pImport->Import();
2734 delete pImport;
2736 return bRet;
2739 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */