1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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>
66 #include "Outliner.hxx"
67 #include "drawdoc.hxx"
69 #include "sdresid.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;
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
);
126 if ( pSection
->GetProperty( PID_COMMENTS
, aPropItem
) )
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
;
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
;
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()
178 ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument
* pDocument
, SvStorage
& rStorage_
, SfxMedium
& rMedium
, PowerPointImportParam
& rParam
)
179 : SdrPowerPointImport ( rParam
, rMedium
.GetBaseURL() )
181 , mrStorage ( rStorage_
)
182 , mbDocumentFound ( FALSE
)
183 , mnFilterOptions ( 0 )
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();
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 //////////////////////////////////////////////////////////////////////////
239 //////////////////////////////////////////////////////////////////////////
241 ImplSdPPTImport::~ImplSdPPTImport()
243 for ( void* pPtr
= maSlideNameList
.First(); pPtr
; pPtr
= maSlideNameList
.Next() )
244 delete (String
*)pPtr
;
248 //////////////////////////////////////////////////////////////////////////
252 //////////////////////////////////////////////////////////////////////////
254 sal_Bool
ImplSdPPTImport::Import()
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();
272 SeekOle( pDocShell
, mnFilterOptions
);
275 PropRead
* pDInfoSec2
= new PropRead( mrStorage
, String( RTL_CONSTASCII_USTRINGPARAM( "\005DocumentSummaryInformation" ) ) );
276 if ( pDInfoSec2
->IsValid() )
280 UINT32 nType
, nPropSize
, nPropCount
;
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
);
291 if ( pSection
->GetProperty( PID_SLIDECOUNT
, aPropItem
) )
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;
311 if ( ( nType
== ( VT_VARIANT
| VT_VECTOR
) ) && ( nVecCount
^ 1 ) )
315 for ( i
= 0; i
< nVecCount
; i
++ )
317 if ( !aPropItem
.Read( aUString
, VT_EMPTY
, FALSE
) )
320 if ( ( nType
!= VT_I4
) && ( nType
!= VT_UI4
) )
323 if ( aUString
.EqualsAscii("Slide Titles") || aUString
.EqualsAscii("Folientitel") )
325 nSlideTitleCount
= nTemp
;
326 nSlideTitleIndex
= nEntryCount
;
328 else if ( aUString
.EqualsAscii("Fonts Used") )
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
) )
346 if ( ( nVecCount
>= ( nSlideTitleIndex
+ nSlideTitleCount
) )
347 && ( nType
== ( VT_LPSTR
| VT_VECTOR
) ) )
349 for ( i
= 0; i
!= nSlideTitleIndex
; i
++ )
352 aPropItem
.SeekRel( nTemp
);
354 for ( i
= 0; i
< nSlideTitleCount
; i
++ )
356 if ( !aPropItem
.Read( aUString
, nType
, FALSE
) )
358 String
* pString
= new String( aUString
);
359 if ( pString
->EqualsAscii( "No Slide Title" ))
364 for ( pPtr
= maSlideNameList
.First(); pPtr
; pPtr
= maSlideNameList
.Next() )
366 if ( *((String
*)pPtr
) == *pString
)
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
);
389 if ( pSection
->GetDictionary( aDict
) )
391 UINT32 nPropId
= aDict
.GetProperty( rtl::OUString::createFromAscii("_PID_HLINKS" ));
394 if ( pSection
->GetProperty( nPropId
, aPropItem
) )
396 aPropItem
.Seek( STREAM_SEEK_TO_BEGIN
);
398 if ( nType
== VT_BLOB
)
400 aPropItem
>> nPropSize
403 if ( ! ( nPropCount
% 6 ) )
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;
415 if ( nType
!= VT_I4
)
417 aPropItem
>> pHyperlink
->nPrivate1
419 if ( nType
!= VT_I4
)
421 aPropItem
>> pHyperlink
->nPrivate2
423 if ( nType
!= VT_I4
)
425 aPropItem
>> pHyperlink
->nPrivate3
427 if ( nType
!= VT_I4
)
429 aPropItem
>> pHyperlink
->nInfo
;
430 if ( !aPropItem
.Read( pHyperlink
->aTarget
, VT_EMPTY
) )
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
) )
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 )
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
);
466 sal_uInt16 nPage
= pPageList
->FindPage( nNumber
);
467 if ( nPage
!= PPTSLIDEPERSIST_ENTRY_NOTFOUND
)
470 bSucceeded
= sal_True
;
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
;
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
;
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
)
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
) )
548 if ( !SeekToRec( rStCtrl
, PPT_PST_ExHyperlinkAtom
, nExObjHyperListLen
, NULL
, 0 ) )
550 rStCtrl
.SeekRel( 8 );
551 rStCtrl
>> ((SdHyperlinkEntry
*)pPtr
)->nIndex
;
552 aHyperE
.SeekToEndOfRecord( rStCtrl
);
558 switch ( aUserEditAtom
.eLastViewType
)
560 case 5 : // notes master
562 aVisAreaSize
= aDocAtom
.GetNotesPageSize();
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
);
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
);
596 boost::optional
< sal_Int16
> oStartNumbering
;
597 SfxStyleSheet
* pSheet
;
598 if ( nMasterNum
== 1 )
603 pSheet
= (SfxStyleSheet
*)mpDoc
->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME
)), SD_STYLE_FAMILY_GRAPHICS
);
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 );
616 pSheet
= (SfxStyleSheet
*)mpDoc
->GetStyleSheetPool()->Find( String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS
)), SD_STYLE_FAMILY_PSEUDO
);
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 )
658 // nTitleInstance = TSS_TYPE_TITLE;
659 // nOutlinerInstance = TSS_TYPE_SUBTITLE;
661 /////////////////////
662 // titelstylesheet //
663 /////////////////////
664 pSheet
= pPage
->GetStyleSheetForPresObj( PRESOBJ_TITLE
);
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 ////////////////////////
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" );
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
];
699 pParagraphs
[ nLevel
] = NULL
;
701 for ( nLevel
= 0; nLevel
< 9; delete pParagraphs
[ nLevel
++ ] ) ;
702 /////////////////////////
703 // subtitle stylesheet //
704 /////////////////////////
705 pSheet
= pPage
->GetStyleSheetForPresObj( PRESOBJ_TEXT
);
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
);
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 );
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
;
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
);
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
)
767 pE
= (*pList
)[ nNextMaster
];
769 SdrObject
* pObj
= ImportPageBackgroundObject( *pMPage
, pE
->nBackgroundOffset
, TRUE
); // import background
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
) )
780 mpTracer
->AddAttribute( rtl::OUString::createFromAscii( "MasterPage" ), rtl::OUString::valueOf( (sal_Int32
) (nAktPageNum
+ 1) ) );
782 while( ( rStCtrl
.GetError() == 0 ) && ( rStCtrl
.Tell() < aPageHd
.GetRecEndFilePos() ) )
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
;
807 if ( ( aHd2
.nRecType
== DFF_msofbtSpContainer
) || ( aHd2
.nRecType
== DFF_msofbtSpgrContainer
) )
809 if ( nObjCount
++ ) // skipping the first object
812 aHd2
.SeekToBegOfRecord( rStCtrl
);
813 SdrObject
* pImpObj
= ImportObj( rStCtrl
, (void*)&aProcessData
, aEmpty
, aEmpty
);
816 pImpObj
->SetLayer( mnBackgroundObjectsLayerID
);
817 pMPage
->NbcInsertObject( pImpObj
);
821 aHd2
.SeekToEndOfRecord( rStCtrl
);
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
;
849 aProgTagContentHd
.SeekToEndOfRecord( rStCtrl
);
855 aHd
.SeekToEndOfRecord( rStCtrl
);
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();
883 aTempAttr
.Put( SdrShadowItem( FALSE
) );
884 pObj
->SetMergedItemSet( aTempAttr
);
886 SfxStyleSheet
* pSheet
= pMPage
->GetStyleSheetForPresObj( PRESOBJ_BACKGROUND
);
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
);
898 // tell the page that it's visualization has changed
899 pMPage
->ActionChanged();
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
);
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() ) )
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 :
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
;
982 case PPT_PST_NewlyAddedAtomByXP11008
: // ???
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
);
994 case PPT_PST_HeadersFooters
:
995 case PPT_PST_PPDrawing
:
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
);
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
);
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 );
1041 ((SdrPageObj
*)pPageObj
)->SetReferencedPage(pSdrModel
->GetPage(( nPage
<< 1 ) + 1));
1045 pStbMgr
->SetState( nImportedPages
++ );
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
)
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();
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();
1104 switch ( pSlideLayout
->eLayout
) // Praesentationslayouts fuer Standard-Seiten
1106 case PPT_LAYOUT_TITLEANDBODYSLIDE
:
1108 eAutoLayout
= AUTOLAYOUT_ENUM
;
1109 USHORT nID1
= pSlideLayout
->aPlaceholderId
[ 1 ];
1112 case PPT_PLACEHOLDER_BODY
:
1113 eAutoLayout
= AUTOLAYOUT_ENUM
;
1115 case PPT_PLACEHOLDER_TABLE
:
1116 eAutoLayout
= AUTOLAYOUT_TAB
;
1118 case PPT_PLACEHOLDER_ORGANISZATIONCHART
:
1119 eAutoLayout
= AUTOLAYOUT_ORG
;
1121 case PPT_PLACEHOLDER_GRAPH
:
1122 eAutoLayout
= AUTOLAYOUT_CHART
;
1124 case PPT_PLACEHOLDER_OBJECT
:
1125 eAutoLayout
= AUTOLAYOUT_OBJ
;
1127 case PPT_PLACEHOLDER_VERTICALTEXTBODY
:
1128 eAutoLayout
= AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
;
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
;
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
;
1172 case PPT_LAYOUT_TITLESLIDE
:
1173 eAutoLayout
= AUTOLAYOUT_TITLE
;
1175 case PPT_LAYOUT_ONLYTITLE
:
1176 eAutoLayout
= AUTOLAYOUT_ONLY_TITLE
;
1178 case PPT_LAYOUT_RIGHTCOLUMN2ROWS
:
1179 eAutoLayout
= AUTOLAYOUT_TEXT2OBJ
;
1181 case PPT_LAYOUT_LEFTCOLUMN2ROWS
:
1182 eAutoLayout
= AUTOLAYOUT_2OBJTEXT
;
1184 case PPT_LAYOUT_TOPROW2COLUMN
:
1185 eAutoLayout
= AUTOLAYOUT_2OBJOVERTEXT
;
1187 case PPT_LAYOUT_4OBJECTS
:
1188 eAutoLayout
= AUTOLAYOUT_4OBJ
;
1190 case PPT_LAYOUT_BIGOBJECT
:
1191 eAutoLayout
= AUTOLAYOUT_OBJ
;
1193 case PPT_LAYOUT_TITLERIGHTBODYLEFT
:
1194 eAutoLayout
= AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
; // AUTOLAYOUT_ENUM;
1196 case PPT_LAYOUT_TITLERIGHT2BODIESLEFT
:
1197 eAutoLayout
= AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
; // AUTOLAYOUT_TEXT2OBJ;
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
;
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
)
1229 pPage
->SetName( *pName
);
1231 *pName
= pPage
->GetName();
1234 if ( mbDocumentFound
)
1236 mpDoc
->SetSummationOfParagraphs( sal_True
);
1239 ::sd::FrameView
* pFrameView
= mpDoc
->GetFrameView( 0 );
1242 List
* pFrameViewList
= mpDoc
->GetFrameViewList();
1243 if ( pFrameViewList
)
1245 pFrameView
= new ::sd::FrameView( mpDoc
);
1247 pFrameViewList
->Insert( 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();
1262 pSet
->Put( SfxUInt16Item( SID_VIEW_ID
, 3 ) );
1265 case 8 : // slide sorter
1267 SfxItemSet
* pSet
= mrMed
.GetItemSet();
1269 pSet
->Put( SfxUInt16Item( SID_VIEW_ID
, 2 ) );
1272 case 10 : // titlemaster
1276 ePageKind
= PK_STANDARD
;
1277 eEditMode
= EM_MASTERPAGE
;
1280 case 5 : // notes master
1281 eEditMode
= EM_MASTERPAGE
;
1283 ePageKind
= PK_NOTES
;
1286 ePageKind
= PK_HANDOUT
;
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
) )
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
);
1321 SdCustomShow
* pSdCustomShow
= new SdCustomShow( mpDoc
);
1322 if ( pSdCustomShow
)
1324 pSdCustomShow
->SetName( aCuShow
);
1326 for ( UINT32 nS
= 0; nS
< nSCount
; nS
++ )
1329 rStCtrl
>> nPageNumber
;
1330 USHORT nPage
= pPageList
->FindPage( nPageNumber
);
1331 if ( nPage
!= PPTSLIDEPERSIST_ENTRY_NOTFOUND
)
1333 SdPage
* pPage
= mpDoc
->GetSdPage( nPage
, PK_STANDARD
);
1336 pSdCustomShow
->Insert( pPage
, LIST_APPEND
);
1342 pList
->Insert( pSdCustomShow
, LIST_APPEND
);
1344 delete pSdCustomShow
;
1353 // this is defaulted, maybe there is no SSDocInfoAtom
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
1371 for ( UINT32 i2
= 0; i2
< 32; i2
++ )
1375 aCustomShow
.Append( nChar
);
1378 rStCtrl
.SeekRel( ( 31 - i2
) << 1 );
1384 // set the current custom show
1385 if ( aCustomShow
.Len() )
1388 List
* pList
= mpDoc
->GetCustomShowList( FALSE
);
1391 for ( pPtr
= pList
->First(); pPtr
; pPtr
= pList
->Next() )
1393 if ( ((SdCustomShow
*)pPtr
)->GetName() == aCustomShow
)
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
);
1414 rPresSettings
.maPresPage
= pPage
->GetName();
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
);
1432 void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage
* pPage
, const PptSlidePersistEntry
* pMasterPersist
)
1435 PptSlidePersistList
* pList
= GetPageList( eAktPageKind
);
1436 if ( ( !pList
) || ( pList
->Count() <= nAktPageNum
) )
1438 PptSlidePersistEntry
& rSlidePersist
= *(*pList
)[ nAktPageNum
];
1439 HeaderFooterEntry
* pHFE
= rSlidePersist
.pHeaderFooterEntry
;
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
);
1457 bVisible
= sal_False
;
1458 rStCtrl
.Seek( nPosition
);
1459 ProcessData
aProcessData( rSlidePersist
, (SdPage
*)pPage
);
1460 SdrObject
* pObj
= ImportObj( rStCtrl
, (void*)&aProcessData
, aEmpty
, aEmpty
);
1462 pPage
->NbcInsertObject( pObj
, 0 );
1465 String aPlaceHolderString
;
1466 if ( pHFE
->pPlaceholder
)
1467 aPlaceHolderString
= pHFE
->pPlaceholder
[ i
];
1469 sd::HeaderFooterSettings
rHeaderFooterSettings( pPage
->getHeaderFooterSettings() );
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 );
1485 rHeaderFooterSettings
.mbHeaderVisible
= bVisible
;
1486 rHeaderFooterSettings
.maHeaderText
= aPlaceHolderString
;
1491 rHeaderFooterSettings
.mbFooterVisible
= bVisible
;
1492 rHeaderFooterSettings
.maFooterText
= aPlaceHolderString
;
1497 rHeaderFooterSettings
.mbSlideNumberVisible
= bVisible
;
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() )
1521 if( *p1
.second
< *p2
.second
)
1523 if( *p1
.second
> *p2
.second
)
1525 if( p1
.first
->GetOrdNum() < p2
.first
->GetOrdNum() )
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
;
1562 while ( ( rStCtrl
.GetError() == 0 ) && ( rStCtrl
.Tell() < nPageRecEnd
) )
1564 DffRecordHeader 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();
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
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 ??
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 ??
1627 case PPT_TRANSITION_TYPE_NONE
:
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 );
1641 pPage
->setTransitionType( 0 );
1644 case PPT_TRANSITION_TYPE_DISSOLVE
:
1645 pPage
->SetFadeEffect(::com::sun::star::presentation::FadeEffect_DISSOLVE
); // Aufloesen
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
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
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
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
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
1711 case PPT_TRANSITION_TYPE_RANDOM
:
1712 pPage
->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_RANDOM
); // Automatisch
1714 case PPT_TRANSITION_TYPE_FADE
:
1716 pPage
->setTransitionType( animations::TransitionType::FADE
);
1717 pPage
->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR
);
1718 pPage
->setTransitionFadeColor( 0 );
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
1729 case PPT_TRANSITION_TYPE_DIAMOND
:
1731 pPage
->setTransitionType( animations::TransitionType::IRISWIPE
);
1732 pPage
->setTransitionSubtype( animations::TransitionSubType::DIAMOND
);
1735 case PPT_TRANSITION_TYPE_PLUS
:
1737 pPage
->setTransitionType( animations::TransitionType::FOURBOXWIPE
);
1738 pPage
->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT
);
1741 case PPT_TRANSITION_TYPE_CIRCLE
:
1743 pPage
->setTransitionType( animations::TransitionType::ELLIPSEWIPE
);
1744 pPage
->setTransitionSubtype( animations::TransitionSubType::CIRCLE
);
1747 case PPT_TRANSITION_TYPE_WEDGE
:
1749 pPage
->setTransitionType( animations::TransitionType::FANWIPE
);
1750 pPage
->setTransitionSubtype( animations::TransitionSubType::CENTERTOP
);
1753 case PPT_TRANSITION_TYPE_WHEEL
:
1755 pPage
->setTransitionType( animations::TransitionType::PINWHEELWIPE
);
1757 switch( nDirection
)
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
);
1769 case PPT_TRANSITION_TYPE_PUSH
:
1771 pPage
->setTransitionType( animations::TransitionType::PUSHWIPE
);
1773 switch( nDirection
)
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
);
1784 case PPT_TRANSITION_TYPE_COMB
:
1786 pPage
->setTransitionType( animations::TransitionType::PUSHWIPE
);
1787 pPage
->setTransitionSubtype( nDirection
? animations::TransitionSubType::COMBVERTICAL
: animations::TransitionSubType::COMBHORIZONTAL
);
1790 case PPT_TRANSITION_TYPE_NEWSFLASH
:
1792 pPage
->setTransitionType( animations::TransitionType::ZOOM
);
1793 pPage
->setTransitionSubtype( animations::TransitionSubType::ROTATEIN
);
1796 case PPT_TRANSITION_TYPE_SMOOTHFADE
:
1798 pPage
->setTransitionType( animations::TransitionType::FADE
);
1799 pPage
->setTransitionSubtype( animations::TransitionSubType::CROSSFADE
);
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 );
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
);
1838 aHd
.SeekToEndOfRecord( rStCtrl
);
1840 if ( bTryTwice
&& ( bSSSlideInfoAtom
== 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
];
1852 UINT32 nOfs
= pE
->aPersistAtom
.nReserved
;
1855 rStCtrl
.Seek( nOfs
);
1856 nPageRecEnd
= nOfs
+ 16;
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
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
;
1927 while( !bDone
&& SeekToRec( rStCtrl
, PPT_PST_Sound
, nDataLen
, &aSoundRecHd
) )
1929 UINT32 nStrLen
= aSoundRecHd
.GetRecEndFilePos();
1931 UINT32 nPosMerk2
= rStCtrl
.Tell();
1932 if ( SeekToRec( rStCtrl
, PPT_PST_CString
, nStrLen
, NULL
, 2 ) )
1934 if ( ReadString( aRefStr
) )
1935 bRefStrValid
= TRUE
;
1939 if ( UniString::CreateFromInt32( nSoundRef
) == aRefStr
)
1941 rStCtrl
.Seek( nPosMerk2
);
1942 if ( SeekToRec( rStCtrl
, PPT_PST_CString
, nStrLen
, NULL
, 0 ) )
1944 ReadString( aRetval
);
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
;
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
);
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
);
2011 aSoundRecHd
.SeekToEndOfRecord( rStCtrl
);
2015 rStCtrl
.Seek( nPosMerk
);
2019 //////////////////////////////////////////////////////////////////////////
2021 // media object import, the return value is the url to the media object
2023 //////////////////////////////////////////////////////////////////////////
2025 String
ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef
) const
2028 DffRecordHeader
* pHd( const_cast<ImplSdPPTImport
*>(this)->aDocRecManager
.GetRecordHeader( PPT_PST_ExObjList
, SEEK_FROM_BEGINNING
) );
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
) )
2049 if ( nRef
== nMediaRef
)
2051 aExVideoHd
.SeekToContent( rStCtrl
);
2052 while( rStCtrl
.Tell() < aExVideoHd
.GetRecEndFilePos() )
2054 DffRecordHeader aHd
;
2056 switch( aHd
.nRecType
)
2058 case PPT_PST_CString
:
2060 aHd
.SeekToBegOfRecord( rStCtrl
);
2062 if ( ReadString( aStr
) )
2064 if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aStr
, aRetVal
) )
2066 aRetVal
= INetURLObject( aRetVal
).GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS
);
2072 aHd
.SeekToEndOfRecord( rStCtrl
);
2081 aHdMovie
.SeekToEndOfRecord( rStCtrl
);
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
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;
2113 case 0x02 : // RunProgramAction
2115 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_PROGRAM
;
2116 pInfo
->maBookmark
= aMacroName
; // Programmname in aBookmark
2119 case 0x03 : // JumpAction
2121 switch( pIAtom
->nJump
)
2124 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_NEXTPAGE
; // Next slide
2127 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_PREVPAGE
; // Previous slide
2130 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_FIRSTPAGE
; // First slide
2133 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_LASTPAGE
; // last Slide
2136 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_PREVPAGE
; // Last slide viewed
2139 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_STOPPRESENTATION
; // End show
2142 pInfo
->meClickAction
= ::com::sun::star::presentation::ClickAction_NONE
; // 0x00: no action, else unknown
2149 SdHyperlinkEntry
* pPtr
;
2150 for ( pPtr
= (SdHyperlinkEntry
*)aHyperList
.First(); pPtr
; pPtr
= (SdHyperlinkEntry
*)aHyperList
.Next() )
2152 if ( pPtr
->nIndex
== pIAtom
->nExHyperlinkId
)
2157 switch( pIAtom
->nHyperlinkType
)
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
;
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
;
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
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
;
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
);
2216 case PPT_PLACEHOLDER_MASTERBODY
:
2218 ePresKind
= PRESOBJ_OUTLINE
;
2219 aPresentationText
= pPage
->GetPresObjText( ePresKind
);
2222 case PPT_PLACEHOLDER_MASTERSUBTITLE
:
2224 ePresKind
= PRESOBJ_TEXT
;
2225 aPresentationText
= pPage
->GetPresObjText( ePresKind
);
2228 case PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE
:
2230 ePresKind
= PRESOBJ_NOTES
;
2231 aPresentationText
= pPage
->GetPresObjText( ePresKind
);
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
);
2247 ((SdrAttrObj
*)pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, TRUE
);
2248 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2251 case TSS_TYPE_SUBTITLE
:
2253 pSheet
= pPage
->GetStyleSheetForPresObj( PRESOBJ_TEXT
);
2255 ((SdrAttrObj
*)pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, TRUE
);
2256 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" );
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
);
2270 pText
->StartListening( *pSheet
);
2271 pStyleSheetAry
[ nLevel
- 1 ] = pSheet
;
2273 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for outlinerobject (SJ)" );
2275 ((SdrAttrObj
*)pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, TRUE
);
2276 ppStyleSheetAry
= &pStyleSheetAry
[ 0 ];
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
);
2286 ((SdrAttrObj
*)pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, TRUE
);
2287 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2291 pSheet
= pPage
->GetStyleSheetForPresObj( PRESOBJ_NOTES
);
2292 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for notesobj (SJ)" );
2294 ((SdrAttrObj
*)pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, TRUE
);
2298 case TSS_TYPE_UNUSED
:
2299 case TSS_TYPE_TEXT_IN_SHAPE
:
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
);
2310 pSheet
= (SfxStyleSheet
*)mpDoc
->GetStyleSheetPool()->Find( String(SdResId( STR_STANDARD_STYLESHEET_NAME
)), SD_STYLE_FAMILY_GRAPHICS
);
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
) );
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
);
2365 const PptSlideLayoutAtom
* pSlideLayout
= GetSlideLayoutAtom();
2366 if ( pSlideLayout
|| ( eAktPageKind
== PPT_NOTEPAGE
) )
2368 INT16 nPlaceholderId
= pPlaceHolder
->nPlaceholderId
;
2370 if ( eAktPageKind
== PPT_SLIDEPAGE
)
2372 for ( ; i
< 8; i
++ )
2374 if ( pSlideLayout
->aPlaceholderId
[ i
] == nPlaceholderId
)
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
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
);
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
;
2457 aTitleRect
= pTitleObj
->GetLogicRect();
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
);
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
);
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
);
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
);
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
);
2561 pRet
= NULL
; // return zero cause this obj was already inserted by CreatePresObj
2564 else if ( !pTextObj
->Count() )
2570 if ( pRet
!= pText
)
2572 SdrObject
* pFree( pText
);
2573 SdrObject::Free( pFree
);
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
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();
2594 UINT32 nClientDataLen
= rHdClientData
.GetRecEndFilePos();
2595 DffRecordHeader 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
;
2648 case PPT_PST_InteractiveInfo
:
2650 UINT32 nFilePosMerk2
= rSt
.Tell();
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
) )
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
;
2697 SdrObject::Free( pObj
), pObj
= pMediaObj
; // SJ: hoping that pObj is not inserted in any list
2698 pMediaObj
->setURL( aMediaURL
);
2706 aHd
.SeekToEndOfRecord( rSt
);
2708 while( ( rSt
.GetError() == 0 ) && ( rSt
.Tell() < nClientDataLen
) );
2710 if ( bInhabitanceChecked
|| bAnimationInfoFound
)
2712 bInhabitanceChecked
= TRUE
;
2713 if ( ! ( IsProperty( DFF_Prop_hspMaster
) && SeekToShape( rSt
, pData
, GetPropertyValue( DFF_Prop_hspMaster
) ) ) )
2715 rSt
>> aMasterShapeHd
;
2716 if ( !SeekToRec( rSt
, DFF_msofbtClientData
, aMasterShapeHd
.GetRecEndFilePos(), &aMasterShapeHd
) )
2718 aMasterShapeHd
.SeekToContent( rSt
);
2719 rHdClientData
= aMasterShapeHd
;
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();