1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <osl/file.hxx>
21 #include <sal/log.hxx>
22 #include <unotools/configmgr.hxx>
23 #include <unotools/ucbstreamhelper.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 <svx/svdograf.hxx>
30 #include <svx/svdlayer.hxx>
31 #include <svx/sdmetitm.hxx>
32 #include <svx/sdtmfitm.hxx>
33 #include <svx/sdtagitm.hxx>
34 #include <svl/style.hxx>
35 #include <svl/intitem.hxx>
36 #include <editeng/eeitem.hxx>
37 #include <editeng/editeng.hxx>
38 #include <svx/svdoutl.hxx>
39 #include <svx/xfillit0.hxx>
40 #include <svx/xlineit0.hxx>
42 #include <sfx2/docinf.hxx>
44 #include <strings.hrc>
45 #include <strings.hxx>
47 #include <drawdoc.hxx>
49 #include <sdresid.hxx>
51 #include <stlpool.hxx>
52 #include <anminfo.hxx>
53 #include <svx/gallery.hxx>
54 #include <tools/debug.hxx>
55 #include <tools/urlobj.hxx>
56 #include <svx/svdopage.hxx>
57 #include <svx/svdomedia.hxx>
58 #include <svx/svdogrp.hxx>
59 #include "propread.hxx"
60 #include <cusshow.hxx>
61 #include <xmloff/autolayout.hxx>
63 #include <customshowlist.hxx>
66 #include <DrawDocShell.hxx>
67 #include <FrameView.hxx>
68 #include <unokywds.hxx>
70 #include <unotools/fltrcfg.hxx>
71 #include <sfx2/progress.hxx>
72 #include <editeng/editstat.hxx>
73 #include <unotools/pathoptions.hxx>
75 #define MAX_USER_MOVE 2
77 #include "pptanimations.hxx"
78 #include "pptinanimations.hxx"
79 #include "ppt97animations.hxx"
81 #include <com/sun/star/animations/TransitionSubType.hpp>
82 #include <com/sun/star/animations/TransitionType.hpp>
83 #include <com/sun/star/document/XDocumentProperties.hpp>
84 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
85 #include <com/sun/star/drawing/LineStyle.hpp>
86 #include <com/sun/star/frame/XModel.hpp>
87 #include <comphelper/string.hxx>
88 #include <oox/ole/olehelper.hxx>
94 #include <string_view>
96 using namespace ::com::sun::star
;
98 SdPPTImport::SdPPTImport( SdDrawDocument
* pDocument
, SvStream
& rDocStream
, SotStorage
& rStorage
, SfxMedium
& rMedium
)
102 std::unique_ptr
<PropRead
> pSummaryInformation(new PropRead( rStorage
, "\005SummaryInformation" ));
103 if ( pSummaryInformation
->IsValid() )
105 pSummaryInformation
->Read();
106 sal_uInt8
const aPropSetGUID
[ 16 ]
108 0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9
110 Section
* pSection
= const_cast<Section
*>(pSummaryInformation
->GetSection( aPropSetGUID
));
114 if ( pSection
->GetProperty( PID_COMMENTS
, aPropItem
) )
117 aPropItem
.Read( aComment
);
118 if ( aComment
.indexOf( "Applixware" ) >= 0 )
120 maParam
.nImportFlags
|= PPT_IMPORTFLAGS_NO_TEXT_ASSERT
;
125 pSummaryInformation
.reset();
128 tools::SvRef
<SotStorageStream
> pCurrentUserStream(rStorage
.OpenSotStream("Current User", StreamMode::STD_READ
));
129 if (pCurrentUserStream
)
131 ReadPptCurrentUserAtom(*pCurrentUserStream
, maParam
.aCurrentUserAtom
);
136 // iterate over all styles
137 SdStyleSheetPool
* pStyleSheetPool
= pDocument
->GetSdStyleSheetPool();
138 std::shared_ptr
<SfxStyleSheetIterator
> aIter
=
139 std::make_shared
<SfxStyleSheetIterator
>(pStyleSheetPool
, SfxStyleFamily::All
);
141 for (SfxStyleSheetBase
*pSheet
= aIter
->First(); pSheet
; pSheet
= aIter
->Next())
143 SfxItemSet
& rSet
= pSheet
->GetItemSet();
144 // if autokerning is set in style, override it, ppt has no autokerning
145 if( rSet
.GetItemState( EE_CHAR_PAIRKERNING
, false ) == SfxItemState::SET
)
146 rSet
.ClearItem( EE_CHAR_PAIRKERNING
);
150 pFilter
.reset(new ImplSdPPTImport(pDocument
, rStorage
, rMedium
, maParam
));
153 bool SdPPTImport::Import()
155 return pFilter
->Import();
158 SdPPTImport::~SdPPTImport()
162 ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument
* pDocument
, SotStorage
& rStorage_
, SfxMedium
& rMedium
, PowerPointImportParam
& rParam
)
163 : SdrPowerPointImport(rParam
, rMedium
.GetBaseURL())
165 , mrStorage(rStorage_
)
166 , mbDocumentFound(false)
169 , mePresChange(PresChange::Manual
)
170 , mnBackgroundObjectsLayerID(0)
175 mbDocumentFound
= SeekToDocument( &maDocHd
); // maDocHd = the latest DocumentHeader
176 while ( SeekToRec( rStCtrl
, PPT_PST_Document
, nStreamLen
, &maDocHd
) )
177 mbDocumentFound
= true;
179 sal_uInt32 nDggContainerOfs
= 0;
181 if ( mbDocumentFound
)
183 sal_uLong nOldPos
= rStCtrl
.Tell();
185 mxPicturesStream
= rStorage_
.OpenSotStream( "Pictures", StreamMode::STD_READ
);
186 pStData
= mxPicturesStream
.get();
188 rStCtrl
.Seek( maDocHd
.GetRecBegFilePos() + 8 );
189 sal_uLong nDocLen
= maDocHd
.GetRecEndFilePos();
190 DffRecordHeader aPPDGHd
;
191 if ( SeekToRec( rStCtrl
, PPT_PST_PPDrawingGroup
, nDocLen
, &aPPDGHd
) )
193 sal_uLong nPPDGLen
= aPPDGHd
.GetRecEndFilePos();
194 if ( SeekToRec( rStCtrl
, DFF_msofbtDggContainer
, nPPDGLen
) )
195 nDggContainerOfs
= rStCtrl
.Tell();
197 rStCtrl
.Seek( nOldPos
);
199 sal_uInt32 nSvxMSDffOLEConvFlags2
= 0;
201 const SvtFilterOptions
& rBasOpt
= SvtFilterOptions::Get();
202 if ( rBasOpt
.IsLoadPPointBasicCode() )
203 mnFilterOptions
|= 1;
204 if ( rBasOpt
.IsMathType2Math() )
205 nSvxMSDffOLEConvFlags2
|= OLE_MATHTYPE_2_STARMATH
;
206 if ( rBasOpt
.IsWinWord2Writer() )
207 nSvxMSDffOLEConvFlags2
|= OLE_WINWORD_2_STARWRITER
;
208 if ( rBasOpt
.IsExcel2Calc() )
209 nSvxMSDffOLEConvFlags2
|= OLE_EXCEL_2_STARCALC
;
210 if ( rBasOpt
.IsPowerPoint2Impress() )
211 nSvxMSDffOLEConvFlags2
|= OLE_POWERPOINT_2_STARIMPRESS
;
213 InitSvxMSDffManager( nDggContainerOfs
, pStData
, nSvxMSDffOLEConvFlags2
);
214 SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS
215 | SVXMSDFF_SETTINGS_IMPORT_PPT
);
216 SetModel( mpDoc
, 576 );
220 ImplSdPPTImport::~ImplSdPPTImport()
223 mxPicturesStream
.clear();
227 bool ImplSdPPTImport::Import()
232 bool bWasLocked
= pSdrModel
->isLocked();
233 pSdrModel
->setLock(true);
234 const bool bSavedUndoEnabled
= pSdrModel
->IsUndoEnabled();
235 pSdrModel
->EnableUndo(false);
237 SdrOutliner
& rOutl
= mpDoc
->GetDrawOutliner();
238 EEControlBits nControlWord
= rOutl
.GetEditEngine().GetControlWord();
239 nControlWord
|= EEControlBits::ULSPACESUMMATION
;
240 const_cast<EditEngine
&>(rOutl
.GetEditEngine()).SetControlWord( nControlWord
);
242 SdrLayerAdmin
& rAdmin
= mpDoc
->GetLayerAdmin();
243 mnBackgroundObjectsLayerID
= rAdmin
.GetLayerID( sUNO_LayerName_background_objects
);
245 ::sd::DrawDocShell
* pDocShell
= mpDoc
->GetDocSh();
247 SeekOle( pDocShell
, mnFilterOptions
);
250 std::unique_ptr
<PropRead
> pDInfoSec2(new PropRead( mrStorage
, "\005DocumentSummaryInformation" ));
251 if ( pDInfoSec2
->IsValid() )
255 sal_uInt32
nType(0), nPropCount(0);
259 sal_uInt8
const aPropSetGUID
[ 16 ]
261 0x02, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
263 Section
* pSection
= const_cast<Section
*>(pDInfoSec2
->GetSection( aPropSetGUID
));
266 if ( pSection
->GetProperty( PID_SLIDECOUNT
, aPropItem
) )
268 aPropItem
.ReadUInt32( nType
);
269 if ( ( nType
== VT_I4
) || ( nType
== VT_UI4
) )
271 // examine PID_HEADINGPAIR to get the correct entry for PID_DOCPARTS
272 sal_uInt32
nSlideCount(0), nVecCount(0);
273 aPropItem
.ReadUInt32( nSlideCount
);
274 if ( nSlideCount
&& pSection
->GetProperty( PID_HEADINGPAIR
, aPropItem
) )
276 sal_uInt32 nSlideTitleIndex
= 0, nSlideTitleCount
= 0;
280 aPropItem
.ReadUInt32( nType
)
281 .ReadUInt32( nVecCount
);
283 if ( ( nType
== ( VT_VARIANT
| VT_VECTOR
) ) && ( nVecCount
^ 1 ) )
286 sal_uInt32 nEntryCount
= 0;
287 for (sal_uInt32 i
= 0; i
< nVecCount
; ++i
)
289 if ( !aPropItem
.Read( aUString
, VT_EMPTY
, false ) )
291 aPropItem
.ReadUInt32( nType
);
292 if ( ( nType
!= VT_I4
) && ( nType
!= VT_UI4
) )
295 aPropItem
.ReadUInt32( nTemp
);
296 if ( aUString
== "Slide Titles" || aUString
== "Folientitel" )
298 nSlideTitleCount
= nTemp
;
299 nSlideTitleIndex
= nEntryCount
;
301 nEntryCount
+= nTemp
;
304 if ( ( nSlideCount
== nSlideTitleCount
) && pSection
->GetProperty( PID_DOCPARTS
, aPropItem
) )
306 aPropItem
.ReadUInt32( nType
)
307 .ReadUInt32( nVecCount
);
309 bool bVecOk
= ( ( nVecCount
>= (nSlideTitleIndex
+ nSlideTitleCount
) )
310 && ( nType
== ( VT_LPSTR
| VT_VECTOR
) ) );
314 for (sal_uInt32 i
= 0; i
!= nSlideTitleIndex
; ++i
)
317 aPropItem
.ReadUInt32(nTemp
);
318 if (!aPropItem
.good())
323 auto nPos
= aPropItem
.Tell() + nTemp
;
324 if (!checkSeek(aPropItem
, nPos
))
333 for (sal_uInt32 i
= 0; i
< nSlideTitleCount
; ++i
)
335 if (!aPropItem
.Read(aUString
, nType
, false))
338 OUString
aString( aUString
);
339 if ( aString
== "No Slide Title" )
343 std::vector
<OUString
>::const_iterator pIter
=
344 std::find(maSlideNameList
.begin(),maSlideNameList
.end(),aString
);
346 if (pIter
!= maSlideNameList
.end())
349 maSlideNameList
.push_back( aString
);
357 sal_uInt8
const aUserPropSetGUID
[ 16 ]
359 0x05, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae
361 pSection
= const_cast<Section
*>(pDInfoSec2
->GetSection( aUserPropSetGUID
));
364 PropDictionary aDict
;
365 pSection
->GetDictionary(aDict
);
368 auto iter
= aDict
.find( OUString("_PID_HLINKS") );
370 if ( iter
!= aDict
.end() )
372 if ( pSection
->GetProperty( iter
->second
, aPropItem
) )
374 aPropItem
.Seek( STREAM_SEEK_TO_BEGIN
);
375 aPropItem
.ReadUInt32( nType
);
376 if ( nType
== VT_BLOB
)
378 sal_uInt32 nPropSize
;
379 aPropItem
.ReadUInt32( nPropSize
)
380 .ReadUInt32( nPropCount
);
382 if ( ! ( nPropCount
% 6 ) )
386 nPropCount
/= 6; // 6 properties per hyperlink
388 for ( i
= 0; i
< nPropCount
; i
++ )
390 SdHyperlinkEntry aHyperlink
;
391 aHyperlink
.nIndex
= 0;
392 aPropItem
.ReadUInt32( nType
);
393 if ( nType
!= VT_I4
)
395 aPropItem
.ReadInt32( aHyperlink
.nPrivate1
)
396 .ReadUInt32( nType
);
397 if ( nType
!= VT_I4
)
399 aPropItem
.ReadInt32( aHyperlink
.nPrivate2
)
400 .ReadUInt32( nType
);
401 if ( nType
!= VT_I4
)
403 aPropItem
.ReadInt32( aHyperlink
.nPrivate3
)
404 .ReadUInt32( nType
);
405 if ( nType
!= VT_I4
)
407 aPropItem
.ReadInt32( aHyperlink
.nInfo
);
408 if ( !aPropItem
.Read( aHyperlink
.aTarget
) )
411 // Convert '\\' notation to 'smb://'
412 INetURLObject
aUrl( aHyperlink
.aTarget
, INetProtocol::File
);
413 aHyperlink
.aTarget
= aUrl
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
415 if ( !aPropItem
.Read( aHyperlink
.aSubAddress
) )
418 if ( !aHyperlink
.aSubAddress
.isEmpty() ) // get the converted subaddress
420 sal_uInt32 nPageNumber
= 0;
421 OUString
aString( aHyperlink
.aSubAddress
);
422 OString aStringAry
[ 3 ];
423 size_t nTokenCount
= 0;
427 aStringAry
[nTokenCount
] =
428 OUStringToOString(aString
.getToken( 0, ',', nPos
), RTL_TEXTENCODING_UTF8
);
430 while ( ++nTokenCount
< SAL_N_ELEMENTS(aStringAry
) && nPos
>= 0 );
432 bool bDocInternalSubAddress
= false;
434 // first pass, searching for a SlideId
435 for( size_t nToken
= 0; nToken
< nTokenCount
; ++nToken
)
437 if (comphelper::string::isdigitAsciiString(aStringAry
[nToken
]))
439 sal_Int32 nNumber
= aStringAry
[ nToken
].toInt32();
440 if ( nNumber
& ~0xff )
442 PptSlidePersistList
* pPageList
= GetPageList( PPT_SLIDEPAGE
);
445 sal_uInt16 nPage
= pPageList
->FindPage( nNumber
);
446 if ( nPage
!= PPTSLIDEPERSIST_ENTRY_NOTFOUND
)
449 bDocInternalSubAddress
= true;
456 if ( !bDocInternalSubAddress
)
457 { // second pass, searching for a SlideName
458 for ( size_t nToken
= 0; nToken
< nTokenCount
; ++nToken
)
460 OUString
aToken(OStringToOUString(aStringAry
[nToken
], RTL_TEXTENCODING_UTF8
));
461 std::vector
<OUString
>::const_iterator pIter
=
462 std::find(maSlideNameList
.begin(),maSlideNameList
.end(),aToken
);
464 if (pIter
!= maSlideNameList
.end())
466 nPageNumber
= pIter
- maSlideNameList
.begin();
467 bDocInternalSubAddress
= true;
471 if ( !bDocInternalSubAddress
)
472 { // third pass, searching for a slide number
473 for ( size_t nToken
= 0; nToken
< nTokenCount
; ++nToken
)
475 if (comphelper::string::isdigitAsciiString(aStringAry
[nToken
]))
477 sal_Int32 nNumber
= aStringAry
[ nToken
].toInt32();
478 if ( ( nNumber
& ~0xff ) == 0 )
480 nPageNumber
= static_cast<sal_uInt32
>(nNumber
) - 1;
481 bDocInternalSubAddress
= true;
487 // if a document internal sub address
488 if ( bDocInternalSubAddress
)
490 if ( nPageNumber
< maSlideNameList
.size() )
491 aHyperlink
.aConvSubString
= maSlideNameList
[ nPageNumber
];
492 if ( aHyperlink
.aConvSubString
.isEmpty() )
494 aHyperlink
.aConvSubString
= SdResId( STR_PAGE
) + " " + mpDoc
->CreatePageNumValue( static_cast<sal_uInt16
>(nPageNumber
) + 1 );
497 // if sub address is given but not internal, use it as it is
498 if ( aHyperlink
.aConvSubString
.isEmpty() )
500 aHyperlink
.aConvSubString
= aString
;
504 m_aHyperList
.push_back( aHyperlink
);
516 if ( mbDocumentFound
)
518 rStCtrl
.Seek( maDocHd
.GetRecBegFilePos() + 8 );
519 // read hyperlist / set indices of the entries
520 DffRecordHeader aHyperHd
;
521 if ( SeekToRec( rStCtrl
, PPT_PST_ExObjList
, maDocHd
.GetRecEndFilePos(), &aHyperHd
) )
523 sal_uInt32 nExObjHyperListLen
= aHyperHd
.GetRecEndFilePos();
524 for (SdHyperlinkEntry
& entry
: m_aHyperList
)
526 DffRecordHeader aHyperE
;
527 if ( !SeekToRec( rStCtrl
, PPT_PST_ExHyperlink
, nExObjHyperListLen
, &aHyperE
) )
529 if ( !SeekToRec( rStCtrl
, PPT_PST_ExHyperlinkAtom
, nExObjHyperListLen
) )
531 rStCtrl
.SeekRel( 8 );
532 rStCtrl
.ReadUInt32( entry
.nIndex
);
533 if (!aHyperE
.SeekToEndOfRecord(rStCtrl
))
537 if (m_aHyperList
.size() == 0)
542 DffRecordHeader aHyperE
;
543 if (!SeekToRec(rStCtrl
, PPT_PST_ExHyperlink
, nExObjHyperListLen
, &aHyperE
))
545 if (!SeekToRec(rStCtrl
, PPT_PST_ExHyperlinkAtom
, nExObjHyperListLen
))
548 SdHyperlinkEntry aHyperlink
;
553 rStCtrl
.ReadUInt32(aHyperlink
.nIndex
);
555 ReadString(aURLText
);
556 ReadString(aURLLink
);
557 aHyperlink
.aTarget
= aURLLink
;
558 m_aHyperList
.push_back(aHyperlink
);
567 switch ( m_aUserEditAtom
.eLastViewType
)
569 case PptViewTypeEnum::Notes
:
570 case PptViewTypeEnum::NotesMaster
:
571 aVisAreaSize
= aDocAtom
.GetNotesPageSize();
574 aVisAreaSize
= aDocAtom
.GetSlidesPageSize();
576 Scale( aVisAreaSize
);
577 pDocShell
->SetVisArea( ::tools::Rectangle( Point(), aVisAreaSize
) );
580 // create master pages:
582 std::unique_ptr
<SfxProgress
> xStbMgr
;
583 if (!utl::ConfigManager::IsFuzzing())
585 xStbMgr
.reset(new SfxProgress(pDocShell
,
586 SdResId( STR_POWERPOINT_IMPORT
),
587 m_pMasterPages
->size() +
588 m_pSlidePages
->size() + m_pNotePages
->size()));
591 sal_uInt32 nImportedPages
= 0;
593 sal_uInt16 nMasterCnt
= GetPageCount( PPT_MASTERPAGE
);
595 for ( sal_uInt16 nMasterNum
= 0; nMasterNum
< nMasterCnt
; nMasterNum
++ )
597 SetPageNum( nMasterNum
, PPT_MASTERPAGE
);
598 rtl::Reference
<SdPage
> pPage
= static_cast<SdPage
*>(MakeBlankPage( true ).get());
601 bool bNotesMaster
= (*GetPageList( m_eCurrentPageKind
) )[ m_nCurrentPageNum
].bNotesMaster
;
602 bool bStarDrawFiller
= (*GetPageList( m_eCurrentPageKind
) )[ m_nCurrentPageNum
].bStarDrawFiller
;
604 PageKind ePgKind
= bNotesMaster
? PageKind::Notes
: PageKind::Standard
;
605 bool bHandout
= (*GetPageList( m_eCurrentPageKind
) )[ m_nCurrentPageNum
].bHandoutMaster
;
607 ePgKind
= PageKind::Handout
;
609 pPage
->SetPageKind( ePgKind
);
610 pSdrModel
->InsertMasterPage( pPage
.get() );
611 if ( bNotesMaster
&& bStarDrawFiller
)
612 pPage
->SetAutoLayout( AUTOLAYOUT_NOTES
, true );
615 std::optional
< sal_Int16
> oStartNumbering
;
616 SfxStyleSheet
* pSheet
;
617 if ( nMasterNum
== 1 )
620 pSheet
= static_cast<SfxStyleSheet
*>(mpDoc
->GetStyleSheetPool()->Find(SdResId(STR_STANDARD_STYLESHEET_NAME
), SfxStyleFamily::Para
));
623 SfxItemSet
& rItemSet
= pSheet
->GetItemSet();
624 PPTParagraphObj
aParagraph( *m_pPPTStyleSheet
, TSS_Type::TextInShape
, 0 );
625 PPTPortionObj
aPortion( *m_pPPTStyleSheet
, TSS_Type::TextInShape
, 0 );
626 aParagraph
.AppendPortion( aPortion
);
627 aParagraph
.ApplyTo( rItemSet
, oStartNumbering
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
628 aPortion
.ApplyTo( rItemSet
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
633 pSheet
= static_cast<SfxStyleSheet
*>(mpDoc
->GetStyleSheetPool()->Find(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS
), SfxStyleFamily::Pseudo
));
636 SfxItemSet
& rItemSet
= pSheet
->GetItemSet();
637 PPTParagraphObj
aParagraph( *m_pPPTStyleSheet
, TSS_Type::TextInShape
, 0 );
638 PPTPortionObj
aPortion( *m_pPPTStyleSheet
, TSS_Type::TextInShape
, 0 );
639 aParagraph
.AppendPortion( aPortion
);
640 aParagraph
.ApplyTo( rItemSet
, oStartNumbering
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
641 aPortion
.ApplyTo( rItemSet
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
644 // create layoutstylesheets, set layoutname and stylesheet
645 // (only on standard and not pages)
647 OUString
aLayoutName( SdResId( STR_LAYOUT_DEFAULT_NAME
) );
648 if ( nMasterNum
> 2 )
650 if ( ePgKind
== PageKind::Standard
)
651 { // standard page: create new presentation layout
652 aLayoutName
= SdResId( STR_LAYOUT_DEFAULT_TITLE_NAME
) +
653 OUString::number( static_cast<sal_Int32
>( ( nMasterNum
+ 1 ) / 2 - 1 ) );
654 static_cast<SdStyleSheetPool
*>( mpDoc
->GetStyleSheetPool() )->CreateLayoutStyleSheets( aLayoutName
);
656 else // note page: use presentation layout of standard page
657 aLayoutName
= static_cast<SdPage
*>( mpDoc
->GetMasterPage( nMasterNum
- 1 ) )->GetName();
659 pPage
->SetName( aLayoutName
);
660 aLayoutName
+= SD_LT_SEPARATOR STR_LAYOUT_OUTLINE
;
661 pPage
->SetLayoutName( aLayoutName
);
664 if ( pPage
->GetPageKind() == PageKind::Standard
)
666 TSS_Type nTitleInstance
= TSS_Type::PageTitle
;
667 TSS_Type nOutlinerInstance
= TSS_Type::Body
;
668 const PptSlideLayoutAtom
* pSlideLayout
= GetSlideLayoutAtom();
669 bool bSwapStyleSheet
= pSlideLayout
->eLayout
== PptSlideLayout::TITLEMASTERSLIDE
;
670 if ( bSwapStyleSheet
)
672 nTitleInstance
= TSS_Type::Title
;
673 nOutlinerInstance
= TSS_Type::Subtitle
;
677 pSheet
= pPage
->GetStyleSheetForPresObj( PresObjKind::Title
);
680 SfxItemSet
& rItemSet
= pSheet
->GetItemSet();
681 PPTParagraphObj
aParagraph( *m_pPPTStyleSheet
, nTitleInstance
, 0 );
682 PPTPortionObj
aPortion( *m_pPPTStyleSheet
, nTitleInstance
, 0 );
683 aParagraph
.AppendPortion( aPortion
);
684 aParagraph
.ApplyTo( rItemSet
, oStartNumbering
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
685 aPortion
.ApplyTo( rItemSet
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
688 // outlinerstylesheet
690 PPTParagraphObj
* pParagraphs
[ 9 ];
692 for ( nLevel
= 0; nLevel
< 9; nLevel
++ )
694 OUString aName
= pPage
->GetLayoutName() +
695 " " + OUString::number( nLevel
+ 1 );
696 SfxStyleSheet
* pOutlineSheet
= static_cast<SfxStyleSheet
*>( mpDoc
->GetStyleSheetPool()->Find( aName
, SfxStyleFamily::Page
) );
697 DBG_ASSERT( pOutlineSheet
, "Template for outline object not found" );
700 pParagraphs
[ nLevel
] = new PPTParagraphObj( *m_pPPTStyleSheet
, nOutlinerInstance
, nLevel
);
701 SfxItemSet
& rItemSet
= pOutlineSheet
->GetItemSet();
702 PPTPortionObj
aPortion( *m_pPPTStyleSheet
, nOutlinerInstance
, nLevel
);
703 pParagraphs
[ nLevel
]->AppendPortion( aPortion
);
704 pParagraphs
[ nLevel
]->ApplyTo( rItemSet
, oStartNumbering
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
705 aPortion
.ApplyTo( rItemSet
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
708 pParagraphs
[ nLevel
] = nullptr;
710 for ( nLevel
= 0; nLevel
< 9; delete pParagraphs
[ nLevel
++ ] ) ;
712 // subtitle stylesheet
713 pSheet
= pPage
->GetStyleSheetForPresObj( PresObjKind::Text
);
716 SfxItemSet
& rItemSet
= pSheet
->GetItemSet();
717 PPTParagraphObj
aParagraph( *m_pPPTStyleSheet
, TSS_Type::Subtitle
, 0 );
718 PPTPortionObj
aPortion( *m_pPPTStyleSheet
, TSS_Type::Subtitle
, 0 );
719 aParagraph
.AppendPortion( aPortion
);
720 aParagraph
.ApplyTo( rItemSet
, oStartNumbering
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
721 aPortion
.ApplyTo( rItemSet
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
724 else if ( ePgKind
== PageKind::Notes
)
726 pSheet
= pPage
->GetStyleSheetForPresObj( PresObjKind::Notes
);
729 SfxItemSet
& rItemSet
= pSheet
->GetItemSet();
730 PPTParagraphObj
aParagraph( *m_pPPTStyleSheet
, TSS_Type::Notes
, 0 );
731 PPTPortionObj
aPortion( *m_pPPTStyleSheet
, TSS_Type::Notes
, 0 );
732 aParagraph
.AppendPortion( aPortion
);
733 aParagraph
.ApplyTo( rItemSet
, oStartNumbering
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
734 aPortion
.ApplyTo( rItemSet
, static_cast<SdrPowerPointImport
&>(*this), TSS_Type::Unknown
);
741 for (sal_uInt16 i
= 0; i
< mpDoc
->GetMasterPageCount(); ++i
)
743 SdPage
*const pMPage(static_cast<SdPage
*>(mpDoc
->GetMasterPage(i
)));
744 if (pMPage
== nullptr)
746 SetPageNum( i
, PPT_MASTERPAGE
);
748 // importing master page objects
749 PptSlidePersistList
* pList
= GetPageList( m_eCurrentPageKind
);
750 PptSlidePersistEntry
* pPersist
= ( pList
&& ( m_nCurrentPageNum
< pList
->size() ) )
751 ? &(*pList
)[ m_nCurrentPageNum
] : nullptr;
754 if ( pPersist
->bStarDrawFiller
&& pPersist
->bNotesMaster
&& ( m_nCurrentPageNum
> 2 ) && ( ( m_nCurrentPageNum
& 1 ) == 0 ) )
756 pSdrModel
->DeleteMasterPage( m_nCurrentPageNum
);
757 SdPage
* pMasterPage2
= static_cast<SdPage
*>(pSdrModel
->GetMasterPage( 2 ));
758 rtl::Reference
<SdPage
> pNotesClone
= static_cast<SdPage
*>(pMasterPage2
->CloneSdrPage(*pSdrModel
).get());
759 pSdrModel
->InsertMasterPage( pNotesClone
.get(), m_nCurrentPageNum
);
762 OUString
aLayoutName( static_cast<SdPage
*>(pSdrModel
->GetMasterPage( m_nCurrentPageNum
- 1 ))->GetLayoutName() );
763 pNotesClone
->SetPresentationLayout( aLayoutName
, false, false );
764 pNotesClone
->SetLayoutName( aLayoutName
);
767 else if ( !pPersist
->bStarDrawFiller
)
769 PptSlidePersistEntry
* pE
= pPersist
;
770 while( ( pE
->aSlideAtom
.nFlags
& 4 ) && pE
->aSlideAtom
.nMasterId
)
772 auto nOrigMasterId
= pE
->aSlideAtom
.nMasterId
;
773 sal_uInt16 nNextMaster
= m_pMasterPages
->FindPage(nOrigMasterId
);
774 if ( nNextMaster
== PPTSLIDEPERSIST_ENTRY_NOTFOUND
)
777 pE
= &(*pList
)[ nNextMaster
];
778 if (pE
->aSlideAtom
.nMasterId
== nOrigMasterId
)
780 SAL_WARN("filter.ms", "loop in atom chain");
784 SdrObject
* pObj
= ImportPageBackgroundObject( *pMPage
, pE
->nBackgroundOffset
); // import background
786 pMPage
->NbcInsertObject( pObj
);
788 bool bNewAnimationsUsed
= false;
789 ProcessData
aProcessData( (*pList
)[ m_nCurrentPageNum
], SdPageCapsule(pMPage
) );
790 sal_uInt32 nOldFPos
= rStCtrl
.Tell();
791 DffRecordHeader aPageHd
;
792 if ( SeekToCurrentPage( &aPageHd
) )
794 auto nEndRecPos
= SanitizeEndPos(rStCtrl
, aPageHd
.GetRecEndFilePos());
795 while( ( rStCtrl
.GetError() == ERRCODE_NONE
) && ( rStCtrl
.Tell() < nEndRecPos
) )
798 if (!ReadDffRecordHeader( rStCtrl
, aHd
))
800 switch( aHd
.nRecType
)
802 case PPT_PST_PPDrawing
:
804 aHd
.SeekToBegOfRecord( rStCtrl
);
805 DffRecordHeader aPPDrawHd
;
806 if ( SeekToRec( rStCtrl
, PPT_PST_PPDrawing
, aHd
.GetRecEndFilePos(), &aPPDrawHd
) )
808 sal_uInt32 nPPDrawEnd
= aPPDrawHd
.GetRecEndFilePos();
809 DffRecordHeader aEscherF002Hd
;
810 if ( SeekToRec( rStCtrl
, DFF_msofbtDgContainer
, nPPDrawEnd
, &aEscherF002Hd
) )
812 sal_uInt32 nEscherF002End
= aEscherF002Hd
.GetRecEndFilePos();
813 DffRecordHeader aEscherObjListHd
;
814 if ( SeekToRec( rStCtrl
, DFF_msofbtSpgrContainer
, nEscherF002End
, &aEscherObjListHd
) )
816 sal_uInt32 nObjCount
= 0;
817 auto nListEndRecPos
= SanitizeEndPos(rStCtrl
, aEscherObjListHd
.GetRecEndFilePos());
818 while( ( rStCtrl
.GetError() == ERRCODE_NONE
) && ( rStCtrl
.Tell() < nListEndRecPos
) )
820 DffRecordHeader aHd2
;
821 ReadDffRecordHeader( rStCtrl
, aHd2
);
822 if ( ( aHd2
.nRecType
== DFF_msofbtSpContainer
) || ( aHd2
.nRecType
== DFF_msofbtSpgrContainer
) )
824 if ( nObjCount
++ ) // skipping the first object
826 ::tools::Rectangle aEmpty
;
827 if (!aHd2
.SeekToBegOfRecord(rStCtrl
))
829 SdrObject
* pImpObj
= ImportObj( rStCtrl
, aProcessData
, aEmpty
, aEmpty
, /*nCalledByGroup*/0, /*pShapeId*/ nullptr );
832 pImpObj
->SetLayer( mnBackgroundObjectsLayerID
);
833 pMPage
->NbcInsertObject( pImpObj
);
837 if (!aHd2
.SeekToEndOfRecord(rStCtrl
))
846 case PPT_PST_ProgTags
:
848 DffRecordHeader aProgTagHd
;
849 if ( SeekToContentOfProgTag( 10, rStCtrl
, aPageHd
, aProgTagHd
) )
851 auto nTagEndRecPos
= SanitizeEndPos(rStCtrl
, aProgTagHd
.GetRecEndFilePos());
852 while ( ( rStCtrl
.GetError() == ERRCODE_NONE
) && ( rStCtrl
.Tell() < nTagEndRecPos
) )
854 DffRecordHeader aProgTagContentHd
;
855 ReadDffRecordHeader( rStCtrl
, aProgTagContentHd
);
856 switch( aProgTagContentHd
.nRecType
)
858 case DFF_msofbtAnimGroup
:
860 css::uno::Reference
< css::drawing::XDrawPage
> xPage( pMPage
->getUnoPage(), css::uno::UNO_QUERY
);
861 ppt::AnimationImporter
aImporter( this, rStCtrl
);
862 bNewAnimationsUsed
= aImporter
.import( xPage
, aProgTagContentHd
) > 0;
866 if (!aProgTagContentHd
.SeekToEndOfRecord(rStCtrl
))
873 bool bSuccess
= aHd
.SeekToEndOfRecord(rStCtrl
);
876 SAL_WARN("filter.ms", "Could not seek to end of record");
881 rStCtrl
.Seek( nOldFPos
);
882 ImportPageEffect( pMPage
, bNewAnimationsUsed
);
885 pObj
= pMPage
->GetObj( 0 );
886 if ( pObj
&& pObj
->GetObjIdentifier() == OBJ_RECT
)
888 if ( pMPage
->GetPageKind() == PageKind::Standard
)
890 // transform data from imported background object to new form
891 // and delete the object. It was used as container to transport
892 // the attributes of the MasterPage background fill
893 SfxStyleSheet
* pSheet
= pMPage
->GetStyleSheetForMasterPageBackground();
897 // if we have a StyleSheet (for Masterpages), set attributes there and use it
898 pSheet
->GetItemSet().ClearItem();
899 pSheet
->GetItemSet().Put(pObj
->GetMergedItemSet());
900 pMPage
->getSdrPageProperties().ClearItem();
901 pMPage
->getSdrPageProperties().SetStyleSheet(pSheet
);
905 // without StyleSheet, set attributes directly. This
906 // should not be done at all and is an error (will be asserted by SdrPage)
907 pMPage
->getSdrPageProperties().ClearItem();
908 pMPage
->getSdrPageProperties().PutItemSet(pObj
->GetMergedItemSet());
911 pMPage
->RemoveObject(pObj
->GetOrdNum());
912 SdrObject::Free(pObj
);
918 xStbMgr
->SetState( nImportedPages
++ );
921 // importing slide pages
923 sal_uInt32 nOldFPos
= rStCtrl
.Tell();
924 PptPageKind ePageKind
= m_eCurrentPageKind
;
925 sal_uInt16 nPageNum
= m_nCurrentPageNum
;
927 rtl::Reference
<SdPage
> pHandoutPage
= static_cast<SdPage
*>(MakeBlankPage( false ).get());
928 pHandoutPage
->SetPageKind( PageKind::Handout
);
929 pSdrModel
->InsertPage( pHandoutPage
.get() );
931 sal_uInt16 nPageCnt
= GetPageCount();
934 for ( sal_uInt16 nPage
= 0; nPage
< nPageCnt
; nPage
++ )
936 mePresChange
= PresChange::SemiAuto
;
938 rtl::Reference
<SdPage
> pPage
= static_cast<SdPage
*>(MakeBlankPage( false ).get());
939 PptSlidePersistEntry
* pMasterPersist
= nullptr;
940 if ( HasMasterPage( nPage
) ) // try to get the LayoutName from the masterpage
942 sal_uInt16 nMasterNum
= GetMasterPageIndex( m_nCurrentPageNum
, m_eCurrentPageKind
);
943 pPage
->TRG_SetMasterPage(*pSdrModel
->GetMasterPage(nMasterNum
));
944 PptSlidePersistList
* pPageList
= GetPageList( PPT_MASTERPAGE
);
945 if ( pPageList
&& nMasterNum
< pPageList
->size() )
946 pMasterPersist
= &(*pPageList
)[ nMasterNum
];
947 pPage
->SetLayoutName(static_cast<SdPage
&>(pPage
->TRG_GetMasterPage()).GetLayoutName());
949 pPage
->SetPageKind( PageKind::Standard
);
950 pSdrModel
->InsertPage( pPage
.get() ); // SJ: #i29625# because of form controls, the
951 ImportPage( pPage
.get(), pMasterPersist
); // page must be inserted before importing
952 SetHeaderFooterPageSettings( pPage
.get(), pMasterPersist
);
953 // CWS preseng01: pPage->SetPageKind( PageKind::Standard );
955 DffRecordHeader aPageHd
;
956 if ( SeekToCurrentPage( &aPageHd
) )
958 bool bNewAnimationsUsed
= false;
960 aPageHd
.SeekToContent( rStCtrl
);
961 auto nEndRecPos
= SanitizeEndPos(rStCtrl
, aPageHd
.GetRecEndFilePos());
962 while ( ( rStCtrl
.GetError() == ERRCODE_NONE
) && ( rStCtrl
.Tell() < nEndRecPos
) )
965 ReadDffRecordHeader( rStCtrl
, aHd
);
966 switch ( aHd
.nRecType
)
968 case PPT_PST_ProgTags
:
970 DffRecordHeader aProgTagHd
;
971 if ( SeekToContentOfProgTag( 10, rStCtrl
, aPageHd
, aProgTagHd
) )
973 auto nHdEndRecPos
= SanitizeEndPos(rStCtrl
, aProgTagHd
.GetRecEndFilePos());
974 while ( ( rStCtrl
.GetError() == ERRCODE_NONE
) && ( rStCtrl
.Tell() < nHdEndRecPos
) )
976 DffRecordHeader aProgTagContentHd
;
977 ReadDffRecordHeader( rStCtrl
, aProgTagContentHd
);
978 switch( aProgTagContentHd
.nRecType
)
980 case DFF_msofbtAnimGroup
:
982 css::uno::Reference
< css::drawing::XDrawPage
> xPage( pPage
->getUnoPage(), css::uno::UNO_QUERY
);
983 ppt::AnimationImporter
aImporter( this, rStCtrl
);
984 bNewAnimationsUsed
= aImporter
.import( xPage
, aProgTagContentHd
) > 0;
988 case PPT_PST_HashCodeAtom
: // ???
991 case PPT_PST_SlideTime10Atom
: // ??? don't know, this atom is always 8 bytes big
992 break; // and is appearing in nearly every l10 progtag
994 if (!aProgTagContentHd
.SeekToEndOfRecord(rStCtrl
))
1001 case PPT_PST_HeadersFooters
:
1002 case PPT_PST_PPDrawing
:
1007 if (!aHd
.SeekToEndOfRecord(rStCtrl
))
1010 ImportPageEffect( pPage
.get(), bNewAnimationsUsed
);
1013 // creating the corresponding note page
1014 m_eCurrentPageKind
= PPT_NOTEPAGE
;
1015 rtl::Reference
<SdPage
> pNotesPage
= static_cast<SdPage
*>(MakeBlankPage( false ).get());
1016 sal_uInt16 nNotesMasterNum
= GetMasterPageIndex( nPage
) + 1;
1017 sal_uInt32 nNotesPageId
= GetNotesPageId( nPage
);
1021 sal_uInt16 nNotesPageIndex
= m_pNotePages
->FindPage( nNotesPageId
);
1022 if ( nNotesPageIndex
== PPTSLIDEPERSIST_ENTRY_NOTFOUND
)
1023 nNotesPageIndex
= 0;
1024 SetPageNum( nNotesPageIndex
, PPT_NOTEPAGE
);
1025 PptSlidePersistEntry
* pMasterPersist2
= nullptr;
1026 if ( HasMasterPage( nNotesPageIndex
, PPT_NOTEPAGE
) ) // try to get the LayoutName from the masterpage
1028 pNotesPage
->TRG_SetMasterPage(*pSdrModel
->GetMasterPage(nNotesMasterNum
));
1029 PptSlidePersistList
* pPageList
= GetPageList( PPT_MASTERPAGE
);
1030 if ( pPageList
&& nNotesMasterNum
< pPageList
->size() )
1031 pMasterPersist2
= &(*pPageList
)[ nNotesMasterNum
];
1032 pNotesPage
->SetLayoutName( static_cast<SdPage
&>(pNotesPage
->TRG_GetMasterPage()).GetLayoutName() );
1034 pNotesPage
->SetPageKind( PageKind::Notes
);
1035 pNotesPage
->TRG_SetMasterPage(*pSdrModel
->GetMasterPage(nNotesMasterNum
));
1036 pSdrModel
->InsertPage( pNotesPage
.get() ); // SJ: #i29625# because of form controls, the
1037 ImportPage( pNotesPage
.get(), pMasterPersist2
); // page must be inserted before importing
1038 SetHeaderFooterPageSettings( pNotesPage
.get(), pMasterPersist2
);
1039 pNotesPage
->SetAutoLayout( AUTOLAYOUT_NOTES
);
1043 pNotesPage
->SetPageKind( PageKind::Notes
);
1044 pNotesPage
->TRG_SetMasterPage(*pSdrModel
->GetMasterPage(nNotesMasterNum
));
1045 pNotesPage
->SetAutoLayout( AUTOLAYOUT_NOTES
, true );
1046 pSdrModel
->InsertPage( pNotesPage
.get() );
1047 SdrObject
* pPageObj
= pNotesPage
->GetPresObj( PresObjKind::Page
);
1049 static_cast<SdrPageObj
*>(pPageObj
)->SetReferencedPage(pSdrModel
->GetPage(( nPage
<< 1 ) + 1));
1053 xStbMgr
->SetState( nImportedPages
++ );
1058 // that can happen by document templates
1059 m_eCurrentPageKind
= PPT_SLIDEPAGE
;
1060 rtl::Reference
<SdPage
> pPage
= static_cast<SdPage
*>(MakeBlankPage( false ).get());
1061 pSdrModel
->InsertPage( pPage
.get() );
1063 // #i37397#, trying to set the title master for the first page
1064 sal_uInt16 nMaster
, nMasterCount
= pSdrModel
->GetMasterPageCount();
1065 SdPage
* pFoundMaster
= nullptr;
1066 for ( nMaster
= 1; nMaster
< nMasterCount
; nMaster
++ )
1068 SdPage
* pMaster
= static_cast<SdPage
*>( pSdrModel
->GetMasterPage( nMaster
) );
1069 if ( pMaster
->GetPageKind() == PageKind::Standard
)
1071 SetPageNum( nMaster
, PPT_MASTERPAGE
);
1072 if ( !pFoundMaster
)
1073 pFoundMaster
= pMaster
;
1074 else if ( GetSlideLayoutAtom()->eLayout
== PptSlideLayout::TITLEMASTERSLIDE
)
1075 pFoundMaster
= pMaster
;
1076 if ( GetSlideLayoutAtom()->eLayout
== PptSlideLayout::TITLEMASTERSLIDE
)
1082 pPage
->TRG_SetMasterPage( *pFoundMaster
);
1083 pPage
->SetLayoutName( pFoundMaster
->GetLayoutName() );
1085 pPage
->SetAutoLayout( AUTOLAYOUT_TITLE
, true, true );
1087 m_eCurrentPageKind
= PPT_NOTEPAGE
;
1088 rtl::Reference
<SdrPage
> pNPage
= MakeBlankPage( false );
1089 pSdrModel
->InsertPage( pNPage
.get() );
1091 SetPageNum( nPageNum
, ePageKind
);
1092 rStCtrl
.Seek( nOldFPos
);
1095 // create handout and note pages
1096 m_bOk
= mpDoc
->CreateMissingNotesAndHandoutPages();
1099 for ( sal_uInt16 i
= 0; i
< mpDoc
->GetSdPageCount( PageKind::Standard
); i
++ )
1104 SdPage
* pPage
= mpDoc
->GetSdPage( i
, PageKind::Standard
);
1105 AutoLayout eAutoLayout
= AUTOLAYOUT_NONE
;
1106 const PptSlideLayoutAtom
* pSlideLayout
= GetSlideLayoutAtom();
1109 switch ( pSlideLayout
->eLayout
) // presentation layout for standard pages
1111 case PptSlideLayout::TITLEANDBODYSLIDE
:
1113 eAutoLayout
= AUTOLAYOUT_TITLE_CONTENT
;
1114 PptPlaceholder nID1
= pSlideLayout
->aPlaceholderId
[ 1 ];
1117 case PptPlaceholder::BODY
:
1118 eAutoLayout
= AUTOLAYOUT_TITLE_CONTENT
;
1120 case PptPlaceholder::TABLE
:
1121 eAutoLayout
= AUTOLAYOUT_TAB
;
1123 case PptPlaceholder::ORGANISZATIONCHART
:
1124 eAutoLayout
= AUTOLAYOUT_ORG
;
1126 case PptPlaceholder::GRAPH
:
1127 eAutoLayout
= AUTOLAYOUT_CHART
;
1129 case PptPlaceholder::OBJECT
:
1130 eAutoLayout
= AUTOLAYOUT_OBJ
;
1132 case PptPlaceholder::VERTICALTEXTBODY
:
1133 eAutoLayout
= AUTOLAYOUT_TITLE_VCONTENT
;
1140 case PptSlideLayout::TWOCOLUMNSANDTITLE
:
1142 eAutoLayout
= AUTOLAYOUT_TITLE_2CONTENT
;
1143 PptPlaceholder nID1
= pSlideLayout
->aPlaceholderId
[ 1 ];
1144 PptPlaceholder nID2
= pSlideLayout
->aPlaceholderId
[ 2 ];
1145 if ( nID1
== PptPlaceholder::BODY
&& nID2
== PptPlaceholder::GRAPH
)
1146 eAutoLayout
= AUTOLAYOUT_TEXTCHART
;
1147 else if ( nID1
== PptPlaceholder::GRAPH
&& nID2
== PptPlaceholder::BODY
)
1148 eAutoLayout
= AUTOLAYOUT_CHARTTEXT
;
1149 else if ( nID1
== PptPlaceholder::BODY
&& nID2
== PptPlaceholder::CLIPART
)
1150 eAutoLayout
= AUTOLAYOUT_TEXTCLIP
;
1151 else if ( nID1
== PptPlaceholder::CLIPART
&& nID2
== PptPlaceholder::BODY
)
1152 eAutoLayout
= AUTOLAYOUT_CLIPTEXT
;
1153 else if ( nID1
== PptPlaceholder::CLIPART
&& nID2
== PptPlaceholder::VERTICALTEXTBODY
)
1154 eAutoLayout
= AUTOLAYOUT_TITLE_2VTEXT
;
1155 else if ( ( nID1
== PptPlaceholder::BODY
)
1156 && ( ( nID2
== PptPlaceholder::OBJECT
) || ( nID2
== PptPlaceholder::MEDIACLIP
) ) )
1157 eAutoLayout
= AUTOLAYOUT_TEXTOBJ
;
1158 else if ( ( nID2
== PptPlaceholder::BODY
)
1159 && ( ( nID1
== PptPlaceholder::OBJECT
) || ( nID1
== PptPlaceholder::MEDIACLIP
) ) )
1160 eAutoLayout
= AUTOLAYOUT_OBJTEXT
;
1161 else if ( ( nID1
== PptPlaceholder::OBJECT
) && ( nID2
== PptPlaceholder::OBJECT
) )
1162 eAutoLayout
= AUTOLAYOUT_OBJ
;
1166 case PptSlideLayout::TWOROWSANDTITLE
:
1168 eAutoLayout
= AUTOLAYOUT_TITLE_2CONTENT
;
1169 PptPlaceholder nID1
= pSlideLayout
->aPlaceholderId
[ 1 ];
1170 PptPlaceholder nID2
= pSlideLayout
->aPlaceholderId
[ 2 ];
1171 if ( nID1
== PptPlaceholder::BODY
&& nID2
== PptPlaceholder::OBJECT
)
1172 eAutoLayout
= AUTOLAYOUT_TEXTOVEROBJ
;
1173 else if ( nID1
== PptPlaceholder::OBJECT
&& nID2
== PptPlaceholder::BODY
)
1174 eAutoLayout
= AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT
;
1178 case PptSlideLayout::TITLESLIDE
:
1179 eAutoLayout
= AUTOLAYOUT_TITLE
;
1181 case PptSlideLayout::ONLYTITLE
:
1182 eAutoLayout
= AUTOLAYOUT_TITLE_ONLY
;
1184 case PptSlideLayout::RIGHTCOLUMN2ROWS
:
1185 eAutoLayout
= AUTOLAYOUT_TITLE_CONTENT_2CONTENT
;
1187 case PptSlideLayout::LEFTCOLUMN2ROWS
:
1188 eAutoLayout
= AUTOLAYOUT_TITLE_2CONTENT_CONTENT
;
1190 case PptSlideLayout::TOPROW2COLUMN
:
1191 eAutoLayout
= AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT
;
1193 case PptSlideLayout::FOUROBJECTS
:
1194 eAutoLayout
= AUTOLAYOUT_TITLE_4CONTENT
;
1196 case PptSlideLayout::BIGOBJECT
:
1197 eAutoLayout
= AUTOLAYOUT_OBJ
;
1199 case PptSlideLayout::TITLERIGHTBODYLEFT
:
1200 eAutoLayout
= AUTOLAYOUT_VTITLE_VCONTENT
;
1202 case PptSlideLayout::TITLERIGHT2BODIESLEFT
:
1203 eAutoLayout
= AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT
;
1206 case PptSlideLayout::BOTTOMROW2COLUMNS
:
1207 case PptSlideLayout::BLANKSLIDE
:
1208 case PptSlideLayout::MASTERSLIDE
: // layout of the standard and title master page
1209 case PptSlideLayout::TITLEMASTERSLIDE
:
1210 case PptSlideLayout::MASTERNOTES
: // layout of the note master page
1211 case PptSlideLayout::NOTESTITLEBODY
: // presentation layout for note pages
1212 case PptSlideLayout::HANDOUTLAYOUT
: // presentation layout for handout
1213 eAutoLayout
= AUTOLAYOUT_NONE
;
1216 if ( eAutoLayout
!= AUTOLAYOUT_NONE
)
1217 pPage
->SetAutoLayout( eAutoLayout
);
1221 // handout master page: auto layout
1222 SdPage
* pHandoutMPage
= mpDoc
->GetMasterSdPage( 0, PageKind::Handout
);
1223 pHandoutMPage
->SetAutoLayout( AUTOLAYOUT_HANDOUT6
, true, true );
1226 sal_uInt32 nSlideCount
= GetPageCount();
1227 for ( sal_uInt32 i
= 0; ( i
< nSlideCount
) && ( i
< maSlideNameList
.size() ); i
++ )
1229 SdPage
* pPage
= mpDoc
->GetSdPage( i
, PageKind::Standard
);
1230 OUString
&aName
= maSlideNameList
[ i
];
1233 if ( !aName
.isEmpty() )
1234 pPage
->SetName( aName
);
1236 aName
= pPage
->GetName();
1239 if ( mbDocumentFound
)
1241 mpDoc
->SetSummationOfParagraphs();
1244 ::sd::FrameView
* pFrameView
= mpDoc
->GetFrameView( 0 );
1247 std::vector
<std::unique_ptr
<sd::FrameView
>> &rViews
= mpDoc
->GetFrameViewList();
1248 pFrameView
= new ::sd::FrameView( mpDoc
);
1249 rViews
.push_back( std::unique_ptr
<sd::FrameView
>(pFrameView
) );
1251 sal_uInt16 nSelectedPage
= 0;
1252 PageKind ePageKind
= PageKind::Standard
;
1253 EditMode eEditMode
= EditMode::Page
;
1255 switch ( m_aUserEditAtom
.eLastViewType
)
1257 case PptViewTypeEnum::Outline
:
1259 SfxItemSet
* pSet
= mrMed
.GetItemSet();
1261 pSet
->Put( SfxUInt16Item( SID_VIEW_ID
, 3 ) );
1264 case PptViewTypeEnum::SlideSorter
:
1266 SfxItemSet
* pSet
= mrMed
.GetItemSet();
1268 pSet
->Put( SfxUInt16Item( SID_VIEW_ID
, 2 ) );
1271 case PptViewTypeEnum::TitleMaster
:
1274 case PptViewTypeEnum::SlideMaster
:
1276 ePageKind
= PageKind::Standard
;
1277 eEditMode
= EditMode::MasterPage
;
1280 case PptViewTypeEnum::NotesMaster
:
1281 eEditMode
= EditMode::MasterPage
;
1283 case PptViewTypeEnum::Notes
:
1284 ePageKind
= PageKind::Notes
;
1286 case PptViewTypeEnum::Handout
:
1287 ePageKind
= PageKind::Handout
;
1290 case PptViewTypeEnum::Slide
:
1293 pFrameView
->SetPageKind( ePageKind
);
1294 pFrameView
->SetSelectedPage( nSelectedPage
);
1295 pFrameView
->SetViewShEditMode( eEditMode
);
1297 DffRecordHeader aCustomShowHeader
;
1298 // read and set custom show
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 const auto nRemainingSize
= rStCtrl
.remainingSize();
1316 sal_uInt32 nBCount
= aContent
.nRecLen
;
1317 if (nBCount
> nRemainingSize
)
1319 SAL_WARN("filter.ms", "page number data len longer than remaining stream size");
1320 nBCount
= nRemainingSize
;
1322 sal_uInt32 nSCount
= nBCount
>> 2;
1324 if ( pPageList
&& nSCount
)
1326 SdCustomShowList
* pList
= mpDoc
->GetCustomShowList( true );
1329 std::unique_ptr
<SdCustomShow
> pSdCustomShow(new SdCustomShow
);
1330 pSdCustomShow
->SetName( aCuShow
);
1331 sal_uInt32 nFound
= 0;
1332 for ( sal_uInt32 nS
= 0; nS
< nSCount
; nS
++ )
1334 sal_uInt32 nPageNumber
;
1335 rStCtrl
.ReadUInt32( nPageNumber
);
1336 sal_uInt16 nPage
= pPageList
->FindPage( nPageNumber
);
1337 if ( nPage
!= PPTSLIDEPERSIST_ENTRY_NOTFOUND
)
1339 SdPage
* pPage
= mpDoc
->GetSdPage( nPage
, PageKind::Standard
);
1342 pSdCustomShow
->PagesVector().push_back( pPage
);
1348 pList
->push_back( std::move(pSdCustomShow
) );
1356 // this is defaulted, maybe there is no SSDocInfoAtom
1357 OUStringBuffer aCustomShow
;
1358 sal_uInt32 nFlags
= 1; // Bit 0: Auto advance
1359 sal_uInt16 nStartSlide
= 0;
1361 // read the pres. configuration
1362 rStCtrl
.Seek( maDocHd
.GetRecBegFilePos() + 8 );
1363 if ( SeekToRec( rStCtrl
, PPT_PST_SSDocInfoAtom
, maDocHd
.GetRecEndFilePos(), &aCustomShowHeader
) )
1365 sal_uInt32 nPenColor
= 0x1000000;
1366 sal_Int32 nRestartTime
= 0x7fffffff;
1367 sal_Int16 nEndSlide
= 0;
1368 rStCtrl
.ReadUInt32( nPenColor
)
1369 .ReadInt32( nRestartTime
)
1370 .ReadUInt16( nStartSlide
)
1371 .ReadInt16( nEndSlide
);
1374 for ( sal_uInt32 i2
= 0; i2
< 32; i2
++ )
1376 rStCtrl
.ReadUtf16( nChar
);
1378 aCustomShow
.append( nChar
);
1381 rStCtrl
.SeekRel( ( 31 - i2
) << 1 );
1385 rStCtrl
.ReadUInt32( nFlags
);
1387 // set the current custom show
1388 if ( !aCustomShow
.isEmpty() )
1390 SdCustomShowList
* pList
= mpDoc
->GetCustomShowList();
1393 SdCustomShow
* pPtr
= nullptr;
1394 OUString aCustomShowStr
= aCustomShow
.makeStringAndClear();
1395 for( pPtr
= pList
->First(); pPtr
; pPtr
= pList
->Next() )
1397 if ( pPtr
->GetName() == aCustomShowStr
)
1404 sd::PresentationSettings
& rPresSettings
= mpDoc
->getPresentationSettings();
1406 rPresSettings
.mbManual
= ( nFlags
& 1 ) == 0;
1407 rPresSettings
.mbAnimationAllowed
= ( nFlags
& 2 ) == 0;
1408 rPresSettings
.mbAll
= ( nFlags
& 4 ) == 0;
1409 rPresSettings
.mbCustomShow
= ( nFlags
& 8 ) != 0;
1410 rPresSettings
.mbEndless
= ( nFlags
& 0x80 ) != 0;
1411 rPresSettings
.mbFullScreen
= ( nFlags
& 0x10 ) == 0;
1413 if ( nStartSlide
&& ( nStartSlide
<= GetPageCount() ) )
1415 SdPage
* pPage
= mpDoc
->GetSdPage( nStartSlide
- 1, PageKind::Standard
);
1417 rPresSettings
.maPresPage
= pPage
->GetName();
1423 // read DocumentProperties
1424 uno::Reference
<document::XDocumentPropertiesSupplier
> xDPS(
1425 mpDoc
->GetObjectShell()->GetModel(), uno::UNO_QUERY_THROW
);
1426 uno::Reference
<document::XDocumentProperties
> xDocProps
1427 = xDPS
->getDocumentProperties();
1428 sfx2::LoadOlePropertySet(xDocProps
, &mrStorage
);
1429 xDocProps
->setTemplateName(OUString());
1431 pSdrModel
->setLock(bWasLocked
);
1432 pSdrModel
->EnableUndo(bSavedUndoEnabled
);
1436 void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage
* pPage
, const PptSlidePersistEntry
* pMasterPersist
)
1439 PptSlidePersistList
* pList
= GetPageList( m_eCurrentPageKind
);
1440 if ( ( !pList
) || ( pList
->size() <= m_nCurrentPageNum
) )
1442 PptSlidePersistEntry
& rSlidePersist
= (*pList
)[ m_nCurrentPageNum
];
1443 HeaderFooterEntry
* pHFE
= rSlidePersist
.xHeaderFooterEntry
.get();
1447 for ( i
= 0; i
< 4; i
++ )
1449 bool bVisible
= pHFE
->IsToDisplay( i
);
1450 if ( ( m_eCurrentPageKind
== PPT_SLIDEPAGE
)
1451 && ( rSlidePersist
.aSlideAtom
.aLayout
.eLayout
== PptSlideLayout::TITLESLIDE
)
1452 && ( aDocAtom
.bTitlePlaceholdersOmitted
) )
1456 if ( bVisible
&& pMasterPersist
)
1458 sal_uInt32 nPosition
= pHFE
->NeedToImportInstance( i
, rSlidePersist
);
1461 ::tools::Rectangle aEmpty
;
1463 rStCtrl
.Seek( nPosition
);
1464 ProcessData
aProcessData( rSlidePersist
, SdPageCapsule(pPage
) );
1465 SdrObject
* pObj
= ImportObj( rStCtrl
, aProcessData
, aEmpty
, aEmpty
, /*nCalledByGroup*/0, /*pShapeId*/nullptr );
1467 pPage
->NbcInsertObject( pObj
, 0 );
1470 OUString aPlaceHolderString
= pHFE
->pPlaceholder
[ i
];
1472 sd::HeaderFooterSettings
rHeaderFooterSettings( pPage
->getHeaderFooterSettings() );
1477 rHeaderFooterSettings
.mbDateTimeVisible
= bVisible
;
1478 rHeaderFooterSettings
.mbDateTimeIsFixed
= ( pHFE
->nAtom
& 0x20000 ) == 0;
1479 rHeaderFooterSettings
.maDateTimeText
= aPlaceHolderString
;
1480 SvxDateFormat eDateFormat
;
1481 SvxTimeFormat eTimeFormat
;
1482 PPTFieldEntry::GetDateTime( pHFE
->nAtom
& 0xff, eDateFormat
, eTimeFormat
);
1483 rHeaderFooterSettings
.meDateFormat
= eDateFormat
;
1484 rHeaderFooterSettings
.meTimeFormat
= eTimeFormat
;
1489 rHeaderFooterSettings
.mbHeaderVisible
= bVisible
;
1490 rHeaderFooterSettings
.maHeaderText
= aPlaceHolderString
;
1495 rHeaderFooterSettings
.mbFooterVisible
= bVisible
;
1496 rHeaderFooterSettings
.maFooterText
= aPlaceHolderString
;
1501 rHeaderFooterSettings
.mbSlideNumberVisible
= bVisible
;
1505 pPage
->setHeaderFooterSettings( rHeaderFooterSettings
);
1512 struct Ppt97AnimationStlSortHelper
1514 bool operator()( const std::pair
< SdrObject
*, Ppt97AnimationPtr
>& p1
, const std::pair
< SdrObject
*, Ppt97AnimationPtr
>& p2
);
1519 bool Ppt97AnimationStlSortHelper::operator()( const std::pair
< SdrObject
*, Ppt97AnimationPtr
>& p1
, const std::pair
< SdrObject
*, Ppt97AnimationPtr
>& p2
)
1521 if( !p1
.second
|| !p2
.second
)
1522 return p1
.second
.get() < p2
.second
.get();
1523 if( *p1
.second
< *p2
.second
)
1525 if( *p1
.second
> *p2
.second
)
1527 return p1
.first
->GetOrdNum() < p2
.first
->GetOrdNum();
1530 void ImplSdPPTImport::ImportPageEffect( SdPage
* pPage
, const bool bNewAnimationsUsed
)
1532 sal_uLong nOldFilePos
= rStCtrl
.Tell();
1534 // set PageKind at page (up to now only PageKind::Standard or PageKind::Notes)
1535 if ( pPage
->GetPageKind() == PageKind::Standard
)
1537 PptSlidePersistList
* pPersistList
= GetPageList( m_eCurrentPageKind
);
1538 PptSlidePersistEntry
* pActualSlidePersist
= ( pPersistList
&& ( m_nCurrentPageNum
< pPersistList
->size() ) )
1539 ? &(*pPersistList
)[ m_nCurrentPageNum
] : nullptr;
1541 if ( pActualSlidePersist
&& ( m_eCurrentPageKind
== PPT_SLIDEPAGE
) )
1543 if ( ! ( pActualSlidePersist
->aSlideAtom
.nFlags
& 1 ) ) // do not follow master objects ?
1545 if(pPage
->TRG_HasMasterPage())
1547 SdrLayerIDSet aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1548 aVisibleLayers
.Set(mnBackgroundObjectsLayerID
, false);
1549 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
1553 DffRecordHeader aPageRecHd
;
1554 if ( SeekToCurrentPage( &aPageRecHd
) )
1556 sal_uLong nPageRecEnd
= SanitizeEndPos(rStCtrl
, aPageRecHd
.GetRecEndFilePos());
1558 bool bTryTwice
= ( m_eCurrentPageKind
== PPT_SLIDEPAGE
);
1559 bool bSSSlideInfoAtom
= false;
1562 while ( ( rStCtrl
.GetError() == ERRCODE_NONE
) && ( rStCtrl
.Tell() < nPageRecEnd
) )
1564 DffRecordHeader aHd
;
1565 ReadDffRecordHeader( rStCtrl
, aHd
);
1566 switch ( aHd
.nRecType
)
1568 case PPT_PST_SSSlideInfoAtom
:
1570 bSSSlideInfoAtom
= true;
1571 if ( m_eCurrentPageKind
== 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
.ReadInt32( nSlideTime
) // time to show (in Ticks)
1582 .ReadInt32( nSoundRef
) // Index of SoundCollection
1583 .ReadSChar( nDirection
) // direction of fade effect
1584 .ReadSChar( nTransitionType
) // fade effect
1585 .ReadInt16( nBuildFlags
) // Buildflags (s.u.)
1586 .ReadSChar( nSpeed
) // speed (slow, medium, fast)
1587 .ReadSChar( nByteDummy
).ReadSChar( nByteDummy
).ReadSChar( nByteDummy
);
1589 switch ( nTransitionType
)
1591 case PPT_TRANSITION_TYPE_BLINDS
:
1593 if ( nDirection
== 0 )
1594 pPage
->SetFadeEffect( css::presentation::FadeEffect_VERTICAL_STRIPES
); // fade vertical
1595 else if ( nDirection
== 1 )
1596 pPage
->SetFadeEffect( css::presentation::FadeEffect_HORIZONTAL_STRIPES
); // fade horizontal
1599 case PPT_TRANSITION_TYPE_CHECKER
:
1601 if ( nDirection
== 0 )
1602 pPage
->SetFadeEffect( css::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD
); // fade vertical with offset ??
1603 else if ( nDirection
== 1 )
1604 pPage
->SetFadeEffect( css::presentation::FadeEffect_VERTICAL_CHECKERBOARD
); // fade horizontal with offset ??
1607 case PPT_TRANSITION_TYPE_COVER
:
1609 if ( nDirection
== 0 )
1610 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_RIGHT
); // overlay from right
1611 else if ( nDirection
== 1 )
1612 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_BOTTOM
); // overlay from bottom
1613 else if ( nDirection
== 2 )
1614 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_LEFT
); // overlay from left
1615 else if ( nDirection
== 3 )
1616 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_TOP
); // overlay from top
1617 else if ( nDirection
== 4 )
1618 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT
); // overlay from bottom right ??
1619 else if ( nDirection
== 5 )
1620 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_LOWERLEFT
); // overlay from bottom left ??
1621 else if ( nDirection
== 6 )
1622 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT
); // overlay from top right
1623 else if ( nDirection
== 7 )
1624 pPage
->SetFadeEffect( css::presentation::FadeEffect_MOVE_FROM_UPPERLEFT
); // overlay from top left ??
1627 case PPT_TRANSITION_TYPE_NONE
:
1631 if ( nDirection
== 0 )
1632 pPage
->SetFadeEffect( css::presentation::FadeEffect_NONE
); // direct
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(css::presentation::FadeEffect_DISSOLVE
); // dissolve
1647 case PPT_TRANSITION_TYPE_RANDOM_BARS
:
1649 if ( nDirection
== 0 )
1650 pPage
->SetFadeEffect( css::presentation::FadeEffect_HORIZONTAL_LINES
); // horizontal lines
1651 else if ( nDirection
== 1 )
1652 pPage
->SetFadeEffect( css::presentation::FadeEffect_VERTICAL_LINES
); // vertical lines
1655 case PPT_TRANSITION_TYPE_SPLIT
:
1657 if ( nDirection
== 0 )
1658 pPage
->SetFadeEffect( css::presentation::FadeEffect_OPEN_VERTICAL
); // open horizontal ??
1659 else if ( nDirection
== 1 )
1660 pPage
->SetFadeEffect( css::presentation::FadeEffect_CLOSE_VERTICAL
); // close horizontal ??
1661 else if ( nDirection
== 2 )
1662 pPage
->SetFadeEffect( css::presentation::FadeEffect_OPEN_HORIZONTAL
); // open vertical ??
1663 else if ( nDirection
== 3 )
1664 pPage
->SetFadeEffect( css::presentation::FadeEffect_CLOSE_HORIZONTAL
); // close vertical ??
1667 case PPT_TRANSITION_TYPE_STRIPS
:
1669 if ( nDirection
== 4 )
1670 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_LOWERRIGHT
); // diagonal to top left
1671 else if ( nDirection
== 5 )
1672 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_LOWERLEFT
); // diagonal to top right
1673 else if ( nDirection
== 6 )
1674 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_UPPERRIGHT
); // diagonal to bottom left
1675 else if ( nDirection
== 7 )
1676 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_UPPERLEFT
); // diagonal to bottom right
1679 case PPT_TRANSITION_TYPE_PULL
:
1681 if ( nDirection
== 0 )
1682 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_LEFT
); // uncover to left
1683 else if ( nDirection
== 1 )
1684 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_TOP
); // uncover to top
1685 else if ( nDirection
== 2 )
1686 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_RIGHT
); // uncover to right
1687 else if ( nDirection
== 3 )
1688 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_BOTTOM
); // uncover to bottom
1689 else if ( nDirection
== 4 )
1690 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT
); // uncover to top left
1691 else if ( nDirection
== 5 )
1692 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT
); // uncover to top right
1693 else if ( nDirection
== 6 )
1694 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT
); // uncover to bottom left
1695 else if ( nDirection
== 7 )
1696 pPage
->SetFadeEffect( css::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT
); // uncover to bottom right
1699 case PPT_TRANSITION_TYPE_WIPE
:
1701 if ( nDirection
== 0 )
1702 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_RIGHT
); // roll from right
1703 else if ( nDirection
== 1 )
1704 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_BOTTOM
); // roll from bottom
1705 else if ( nDirection
== 2 )
1706 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_LEFT
); // roll from left
1707 else if ( nDirection
== 3 )
1708 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_FROM_TOP
); // roll from top
1711 case PPT_TRANSITION_TYPE_RANDOM
:
1712 pPage
->SetFadeEffect( css::presentation::FadeEffect_RANDOM
); // automatic
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( css::presentation::FadeEffect_FADE_FROM_CENTER
); // fade from center
1725 else if ( nDirection
== 1 )
1726 pPage
->SetFadeEffect( css::presentation::FadeEffect_FADE_TO_CENTER
); // fade from the outside
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( 1.0 ); // slow
1806 else if ( nSpeed
== 1 )
1807 pPage
->setTransitionDuration( 0.75 ); // medium
1808 else if ( nSpeed
== 2 )
1809 pPage
->setTransitionDuration( 0.5 ); // fast
1811 if ( nBuildFlags
& 0x400 ) // slidechange by time
1812 { // time to show (in Ticks)
1813 pPage
->SetPresChange( PresChange::Auto
);
1814 pPage
->SetTime( nSlideTime
/ 1000.0 );
1817 pPage
->SetPresChange( mePresChange
);
1819 if ( nBuildFlags
& 4 )
1820 pPage
->SetExcluded( true ); // don't show slide
1821 if ( nBuildFlags
& 16 )
1822 { // slide with sound effect
1823 pPage
->SetSound( true );
1824 OUString
aSoundFile( ReadSound( nSoundRef
) );
1825 pPage
->SetSoundFile( aSoundFile
);
1827 if ( nBuildFlags
& ( 1 << 6 ) ) // Loop until next sound
1828 pPage
->SetLoopSound( true );
1829 if ( nBuildFlags
& ( 1 << 8 ) ) // Stop the previous sound
1830 pPage
->SetStopSound( true );
1835 if (!aHd
.SeekToEndOfRecord(rStCtrl
))
1838 if ( bTryTwice
&& !bSSSlideInfoAtom
)
1841 if ( HasMasterPage( m_nCurrentPageNum
, m_eCurrentPageKind
) )
1843 sal_uInt16 nMasterNum
= GetMasterPageIndex( m_nCurrentPageNum
, m_eCurrentPageKind
);
1844 PptSlidePersistList
* pPageList
= GetPageList( PPT_MASTERPAGE
);
1845 if ( pPageList
&& ( nMasterNum
< pPageList
->size() ) )
1847 assert( !pPageList
->is_null( nMasterNum
) );
1848 const PptSlidePersistEntry
& rE
= (*pPageList
)[ nMasterNum
];
1849 sal_uInt32 nOfs
= rE
.aPersistAtom
.nReserved
;
1852 rStCtrl
.Seek( nOfs
);
1853 nPageRecEnd
= nOfs
+ 16;
1865 if ( !bNewAnimationsUsed
)
1867 std::vector
< std::pair
< SdrObject
*, Ppt97AnimationPtr
> > aAnimationsOnThisPage
;
1869 // add effects from page in correct order
1870 SdrObjListIter
aSdrIter( pPage
, SdrIterMode::Flat
);
1871 while ( aSdrIter
.IsMore() )
1873 SdrObject
* pObj
= aSdrIter
.Next();
1874 tAnimationMap::iterator aFound
= maAnimations
.find( pObj
);
1875 if( aFound
!= maAnimations
.end() )
1877 std::pair
< SdrObject
*, Ppt97AnimationPtr
> aPair( (*aFound
).first
, (*aFound
).second
);
1878 aAnimationsOnThisPage
.push_back( aPair
);
1882 std::sort( aAnimationsOnThisPage
.begin(), aAnimationsOnThisPage
.end(), Ppt97AnimationStlSortHelper() );
1884 for( auto& rEntry
: aAnimationsOnThisPage
)
1886 Ppt97AnimationPtr pPpt97Animation
= rEntry
.second
;
1887 if( pPpt97Animation
)
1888 pPpt97Animation
->createAndSetCustomAnimationEffect( rEntry
.first
);
1891 rStCtrl
.Seek( nOldFilePos
);
1896 // Not only the sounds are imported as string, they are also inserted to
1897 // the gallery if they are not already there.
1898 OUString
ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef
) const
1901 sal_uInt32 nOldPos
= rStCtrl
.Tell();
1902 DffRecordHeader aDocHd
;
1903 if ( SeekToDocument( &aDocHd
) )
1905 sal_uInt32 nSoundLen
= aDocHd
.GetRecEndFilePos();
1906 DffRecordHeader aSoundBlockRecHd
;
1907 if( SeekToRec( rStCtrl
, PPT_PST_SoundCollection
, nSoundLen
, &aSoundBlockRecHd
) )
1909 sal_uInt32 nDataLen
= aSoundBlockRecHd
.GetRecEndFilePos();
1910 DffRecordHeader aSoundRecHd
;
1911 bool bRefStrValid
= false;
1914 while( !bDone
&& SeekToRec( rStCtrl
, PPT_PST_Sound
, nDataLen
, &aSoundRecHd
) )
1916 sal_uInt32 nStrLen
= aSoundRecHd
.GetRecEndFilePos();
1918 sal_uInt32 nOldPos2
= rStCtrl
.Tell();
1919 if ( SeekToRec( rStCtrl
, PPT_PST_CString
, nStrLen
, nullptr, 2 ) )
1921 if ( ReadString( aRefStr
) )
1922 bRefStrValid
= true;
1926 if ( std::u16string_view(OUString::number(nSoundRef
)) == aRefStr
)
1928 rStCtrl
.Seek( nOldPos2
);
1929 if ( SeekToRec( rStCtrl
, PPT_PST_CString
, nStrLen
) )
1931 ReadString( aRetval
);
1938 // Check if this sound file already exists.
1939 // If not, it is exported to our local sound directory.
1940 bool bSoundExists
= false;
1941 ::std::vector
< OUString
> aSoundList
;
1943 GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS
, aSoundList
);
1944 GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS
, aSoundList
);
1946 for( size_t n
= 0; ( n
< aSoundList
.size() ) && !bSoundExists
; ++n
)
1948 INetURLObject
aURL( aSoundList
[ n
] );
1950 if (aURL
.GetLastName() == aRetval
)
1952 aRetval
= aSoundList
[ n
];
1953 bSoundExists
= true;
1959 if ( !bSoundExists
)
1961 rStCtrl
.Seek( nOldPos2
);
1962 DffRecordHeader aSoundDataRecHd
;
1963 if ( SeekToRec( rStCtrl
, PPT_PST_SoundData
, nStrLen
, &aSoundDataRecHd
) )
1965 OUString aGalleryDir
;
1966 if (utl::ConfigManager::IsFuzzing())
1967 osl_getTempDirURL(&aGalleryDir
.pData
);
1969 aGalleryDir
= SvtPathOptions().GetGalleryPath();
1970 // Use last token delimited by ';'. copy(lastIndexOf+1) works whether
1971 // string is empty or not and whether ';' is there or not.
1972 INetURLObject
aGalleryUserSound( aGalleryDir
.copy(aGalleryDir
.lastIndexOf(';')+1) );
1974 aGalleryUserSound
.Append( aRetval
);
1975 const auto nRemainingSize
= rStCtrl
.remainingSize();
1976 sal_uInt32 nSoundDataLen
= aSoundDataRecHd
.nRecLen
;
1977 if (nSoundDataLen
> nRemainingSize
)
1979 SAL_WARN("filter.ms", "sound data len longer than remaining stream size");
1980 nSoundDataLen
= nRemainingSize
;
1982 std::vector
<sal_uInt8
> aBuf(nSoundDataLen
);
1984 rStCtrl
.ReadBytes(aBuf
.data(), nSoundDataLen
);
1985 std::unique_ptr
<SvStream
> pOStm
= ::utl::UcbStreamHelper::CreateStream( aGalleryUserSound
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), StreamMode::WRITE
| StreamMode::TRUNC
);
1989 pOStm
->WriteBytes(aBuf
.data(), nSoundDataLen
);
1991 if( pOStm
->GetError() == ERRCODE_NONE
)
1993 GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS
, aGalleryUserSound
.GetMainURL( INetURLObject::DecodeMechanism::NONE
) );
1994 aRetval
= aGalleryUserSound
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
2002 if (!aSoundRecHd
.SeekToEndOfRecord(rStCtrl
))
2008 rStCtrl
.Seek( nOldPos
);
2012 // media object import, the return value is the url to the media object
2013 OUString
ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef
) const
2016 DffRecordHeader
* pHd( const_cast<ImplSdPPTImport
*>(this)->aDocRecManager
.GetRecordHeader( PPT_PST_ExObjList
) );
2019 pHd
->SeekToContent( rStCtrl
);
2020 auto nEndRecPos
= SanitizeEndPos(rStCtrl
, pHd
->GetRecEndFilePos());
2021 while ( ( rStCtrl
.Tell() < nEndRecPos
) && aRetVal
.isEmpty() )
2023 DffRecordHeader aHdMovie
;
2024 ReadDffRecordHeader( rStCtrl
, aHdMovie
);
2025 switch( aHdMovie
.nRecType
)
2027 case PPT_PST_ExAviMovie
:
2028 case PPT_PST_ExMCIMovie
:
2030 DffRecordHeader aExVideoHd
;
2031 if ( SeekToRec( rStCtrl
, PPT_PST_ExVideo
, aHdMovie
.GetRecEndFilePos(), &aExVideoHd
) )
2033 DffRecordHeader aExMediaAtomHd
;
2034 if ( SeekToRec( rStCtrl
, PPT_PST_ExMediaAtom
, aExVideoHd
.GetRecEndFilePos(), &aExMediaAtomHd
) )
2037 rStCtrl
.ReadUInt32( nRef
);
2038 if ( nRef
== nMediaRef
)
2040 aExVideoHd
.SeekToContent( rStCtrl
);
2041 auto nHdEndRecPos
= SanitizeEndPos(rStCtrl
, aExVideoHd
.GetRecEndFilePos());
2042 while (rStCtrl
.Tell() < nHdEndRecPos
)
2044 DffRecordHeader aHd
;
2045 ReadDffRecordHeader( rStCtrl
, aHd
);
2046 switch( aHd
.nRecType
)
2048 case PPT_PST_CString
:
2050 aHd
.SeekToBegOfRecord( rStCtrl
);
2052 if ( ReadString( aStr
) )
2054 if( osl::FileBase::getFileURLFromSystemPath( aStr
, aRetVal
)
2055 == osl::FileBase::E_None
)
2057 aRetVal
= INetURLObject( aRetVal
).GetMainURL( INetURLObject::DecodeMechanism::Unambiguous
);
2065 if (!aHd
.SeekToEndOfRecord(rStCtrl
))
2075 if (!aHdMovie
.SeekToEndOfRecord(rStCtrl
))
2082 // import of objects
2083 void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo
* pInfo
, PptInteractiveInfoAtom
const * pIAtom
, const OUString
& aMacroName
)
2085 // set local information into pInfo
2086 if( pIAtom
->nSoundRef
)
2088 pInfo
->SetBookmark( ReadSound( pIAtom
->nSoundRef
) ); // path to sound file in MS DOS notation
2089 pInfo
->meClickAction
= css::presentation::ClickAction_SOUND
; // RunProgramAction
2092 switch ( pIAtom
->nAction
)
2095 case 0x02 : // RunProgramAction
2097 pInfo
->meClickAction
= css::presentation::ClickAction_PROGRAM
;
2098 pInfo
->SetBookmark( aMacroName
); // program name in aBookmark
2101 case 0x03 : // JumpAction
2103 switch( pIAtom
->nJump
)
2106 pInfo
->meClickAction
= css::presentation::ClickAction_NEXTPAGE
; // Next slide
2109 pInfo
->meClickAction
= css::presentation::ClickAction_PREVPAGE
; // Previous slide
2112 pInfo
->meClickAction
= css::presentation::ClickAction_FIRSTPAGE
; // First slide
2115 pInfo
->meClickAction
= css::presentation::ClickAction_LASTPAGE
; // last Slide
2118 pInfo
->meClickAction
= css::presentation::ClickAction_PREVPAGE
; // Last slide viewed
2121 pInfo
->meClickAction
= css::presentation::ClickAction_STOPPRESENTATION
; // End show
2124 pInfo
->meClickAction
= css::presentation::ClickAction_NONE
; // 0x00: no action, else unknown
2131 SdHyperlinkEntry
* pPtr
= nullptr;
2132 for (SdHyperlinkEntry
& entry
: m_aHyperList
) {
2133 if ( entry
.nIndex
== pIAtom
->nExHyperlinkId
) {
2140 switch( pIAtom
->nHyperlinkType
)
2143 case 8: // hyperlink : URL
2145 if ( !pPtr
->aTarget
.isEmpty() )
2147 ::sd::DrawDocShell
* pDocShell
= mpDoc
->GetDocSh();
2148 SfxMedium
* pMedium
= pDocShell
? pDocShell
->GetMedium() : nullptr;
2151 OUString aBaseURL
= pMedium
->GetBaseURL();
2152 OUString
aBookmarkURL( pInfo
->GetBookmark() );
2153 INetURLObject
aURL( pPtr
->aTarget
);
2154 if( INetProtocol::NotValid
== aURL
.GetProtocol()
2155 && (osl::FileBase::getFileURLFromSystemPath(
2156 pPtr
->aTarget
, aBookmarkURL
)
2157 != osl::FileBase::E_None
) )
2158 aBookmarkURL
.clear();
2159 if( aBookmarkURL
.isEmpty() )
2160 aBookmarkURL
= URIHelper::SmartRel2Abs( INetURLObject(aBaseURL
), pPtr
->aTarget
, URIHelper::GetMaybeFileHdl() );
2161 pInfo
->SetBookmark( aBookmarkURL
);
2162 pInfo
->meClickAction
= css::presentation::ClickAction_PROGRAM
;
2171 case 7: // hyperlink to a page
2173 if ( !pPtr
->aConvSubString
.isEmpty() )
2175 pInfo
->meClickAction
= css::presentation::ClickAction_BOOKMARK
;
2176 pInfo
->SetBookmark( pPtr
->aConvSubString
);
2184 case 0x05 : // OLEAction ( OLEVerb to use, 0==first, 1==second, .. )
2185 case 0x06 : // MediaAction
2186 case 0x07 : // CustomShowAction
2187 default : // 0x00: no action, else unknown action
2192 SdrObject
* ImplSdPPTImport::ApplyTextObj( PPTTextObj
* pTextObj
, SdrTextObj
* pObj
, SdPageCapsule pPageCapsule
,
2193 SfxStyleSheet
* pSheet
, SfxStyleSheet
** ppStyleSheetAry
) const
2195 SdPage
* pPage
= static_cast<SdPage
*>(pPageCapsule
.page
);
2196 SfxStyleSheet
* pStyleSheetAry
[ 9 ];
2197 SdrTextObj
* pText
= pObj
;
2198 SdrObject
* pRet
= pText
;
2200 ppStyleSheetAry
= nullptr;
2202 PresObjKind ePresKind
= PresObjKind::NONE
;
2203 PptOEPlaceholderAtom
* pPlaceHolder
= pTextObj
->GetOEPlaceHolderAtom();
2204 OUString aPresentationText
;
2207 switch( pPlaceHolder
->nPlaceholderId
)
2209 case PptPlaceholder::MASTERNOTESSLIDEIMAGE
:
2210 case PptPlaceholder::MASTERCENTEREDTITLE
:
2211 case PptPlaceholder::MASTERTITLE
:
2213 ePresKind
= PresObjKind::Title
;
2214 aPresentationText
= pPage
->GetPresObjText( ePresKind
);
2217 case PptPlaceholder::MASTERBODY
:
2219 ePresKind
= PresObjKind::Outline
;
2220 aPresentationText
= pPage
->GetPresObjText( ePresKind
);
2223 case PptPlaceholder::MASTERSUBTITLE
:
2225 ePresKind
= PresObjKind::Text
;
2226 aPresentationText
= pPage
->GetPresObjText( ePresKind
);
2229 case PptPlaceholder::MASTERNOTESBODYIMAGE
:
2231 ePresKind
= PresObjKind::Notes
;
2232 aPresentationText
= pPage
->GetPresObjText( ePresKind
);
2235 case PptPlaceholder::MASTERDATE
: ePresKind
= PresObjKind::DateTime
; break;
2236 case PptPlaceholder::MASTERSLIDENUMBER
: ePresKind
= PresObjKind::SlideNumber
;break;
2237 case PptPlaceholder::MASTERFOOTER
: ePresKind
= PresObjKind::Footer
; break;
2238 case PptPlaceholder::MASTERHEADER
: ePresKind
= PresObjKind::Header
; break;
2242 switch ( pTextObj
->GetDestinationInstance() )
2244 case TSS_Type::PageTitle
:
2245 case TSS_Type::Title
:
2247 pSheet
= pPage
->GetStyleSheetForPresObj( PresObjKind::Title
);
2249 static_cast<SdrAttrObj
*>(pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, true );
2250 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2253 case TSS_Type::Subtitle
:
2255 pSheet
= pPage
->GetStyleSheetForPresObj( PresObjKind::Text
);
2257 static_cast<SdrAttrObj
*>(pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, true );
2258 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" );
2261 case TSS_Type::Body
:
2262 case TSS_Type::HalfBody
:
2263 case TSS_Type::QuarterBody
:
2265 for ( sal_uInt16 nLevel
= 9; nLevel
; nLevel
-- )
2267 OUString aName
= pPage
->GetLayoutName() + " " + OUString::number( nLevel
);
2268 pSheet
= static_cast<SfxStyleSheet
*>(mpDoc
->GetStyleSheetPool()->Find( aName
, SfxStyleFamily::Page
));
2270 pText
->StartListening( *pSheet
);
2271 pStyleSheetAry
[ nLevel
- 1 ] = pSheet
;
2273 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for outlinerobject (SJ)" );
2275 static_cast<SdrAttrObj
*>(pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, true );
2276 ppStyleSheetAry
= &pStyleSheetAry
[ 0 ];
2279 case TSS_Type::Notes
:
2281 if ( pPlaceHolder
&& ( ( pPlaceHolder
->nPlaceholderId
== PptPlaceholder::NOTESSLIDEIMAGE
)
2282 || ( pPlaceHolder
->nPlaceholderId
== PptPlaceholder::MASTERNOTESSLIDEIMAGE
) ) )
2284 pSheet
= pPage
->GetStyleSheetForPresObj( PresObjKind::Title
);
2286 static_cast<SdrAttrObj
*>(pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, true );
2287 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" );
2291 pSheet
= pPage
->GetStyleSheetForPresObj( PresObjKind::Notes
);
2292 DBG_ASSERT( pSheet
, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for notesobj (SJ)" );
2294 static_cast<SdrAttrObj
*>(pText
)->SdrAttrObj::NbcSetStyleSheet( pSheet
, true );
2298 case TSS_Type::Unused
:
2299 case TSS_Type::TextInShape
:
2303 case PresObjKind::DateTime
:
2304 case PresObjKind::SlideNumber
:
2305 case PresObjKind::Footer
:
2306 case PresObjKind::Header
:
2307 pSheet
= static_cast<SfxStyleSheet
*>(mpDoc
->GetStyleSheetPool()->Find(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS
), SfxStyleFamily::Pseudo
));
2310 pSheet
= static_cast<SfxStyleSheet
*>(mpDoc
->GetStyleSheetPool()->Find(SdResId(STR_STANDARD_STYLESHEET_NAME
), SfxStyleFamily::Para
));
2317 pText
= static_cast<SdrTextObj
*>(SdrPowerPointImport::ApplyTextObj( pTextObj
, pText
, pPageCapsule
, pSheet
, ppStyleSheetAry
));
2319 if ( pPlaceHolder
&& pPlaceHolder
->nPlaceholderId
!= PptPlaceholder::NONE
)
2321 if ( m_eCurrentPageKind
== PPT_MASTERPAGE
)
2323 bool bCreatePlaceHolder
= ( pTextObj
->GetInstance() != TSS_Type::Unused
);
2324 bool bIsHeaderFooter
= ( ePresKind
== PresObjKind::Header
) || (ePresKind
== PresObjKind::Footer
)
2325 || (ePresKind
== PresObjKind::DateTime
) || (ePresKind
== PresObjKind::SlideNumber
);
2326 if ( bCreatePlaceHolder
&& ( pTextObj
->GetInstance() == TSS_Type::TextInShape
) )
2327 bCreatePlaceHolder
= bIsHeaderFooter
;
2328 if ( bCreatePlaceHolder
)
2330 if ( !bIsHeaderFooter
)
2332 pText
->SetNotVisibleAsMaster( true );
2333 pText
->SetEmptyPresObj( true );
2335 pText
->SetUserCall( pPage
);
2336 pPage
->InsertPresObj( pText
, ePresKind
);
2337 SdrOutliner
* pOutl
= nullptr;
2338 if ( pTextObj
->GetInstance() == TSS_Type::Notes
)
2339 pOutl
= GetDrawOutliner( pText
);
2340 if ( !aPresentationText
.isEmpty() )
2341 pPage
->SetObjText( pText
, pOutl
, ePresKind
, aPresentationText
);
2343 if ( pPage
->GetPageKind() != PageKind::Notes
&& pPage
->GetPageKind() != PageKind::Handout
)
2345 SfxStyleSheet
* pSheet2( pPage
->GetStyleSheetForPresObj( ePresKind
) );
2348 SfxItemSet
& rItemSet
= pSheet2
->GetItemSet();
2349 rItemSet
.Put( pText
->GetMergedItem( SDRATTR_TEXT_LEFTDIST
) );
2350 rItemSet
.Put( pText
->GetMergedItem( SDRATTR_TEXT_RIGHTDIST
) );
2351 rItemSet
.Put( pText
->GetMergedItem( SDRATTR_TEXT_UPPERDIST
) );
2352 rItemSet
.Put( pText
->GetMergedItem( SDRATTR_TEXT_LOWERDIST
) );
2353 rItemSet
.Put( pText
->GetMergedItem( SDRATTR_TEXT_VERTADJUST
) );
2354 rItemSet
.Put( pText
->GetMergedItem( SDRATTR_TEXT_HORZADJUST
) );
2355 if ( pTextObj
->GetInstance() == TSS_Type::Title
2356 || pTextObj
->GetInstance() == TSS_Type::Subtitle
)
2358 rItemSet
.Put( pText
->GetMergedItemSet() );
2363 SfxItemSet
aTempAttr( mpDoc
->GetPool() );
2364 SdrMetricItem
aMinHeight( makeSdrTextMinFrameHeightItem(pText
->GetLogicRect().GetSize().Height()) );
2365 aTempAttr
.Put( aMinHeight
);
2366 SdrOnOffItem
aAutoGrowHeight( makeSdrTextAutoGrowHeightItem(false) );
2367 aTempAttr
.Put( aAutoGrowHeight
);
2368 pText
->SetMergedItemSet(aTempAttr
);
2377 const PptSlideLayoutAtom
* pSlideLayout
= GetSlideLayoutAtom();
2378 if ( pSlideLayout
|| ( m_eCurrentPageKind
== PPT_NOTEPAGE
) )
2380 sal_uInt32 nPlacementId
= pPlaceHolder
->nPlacementId
;
2381 PptPlaceholder nPlaceholderId
= pPlaceHolder
->nPlaceholderId
;
2382 PresObjKind ePresObjKind
= PresObjKind::NONE
;
2383 bool bEmptyPresObj
= true;
2384 bool bVertical
= false;
2385 if ( ( pTextObj
->GetShapeType() == mso_sptRectangle
) || ( pTextObj
->GetShapeType() == mso_sptTextBox
) )
2387 //if a placeholder with some custom attribute,the pTextObj will keep those attr,whose text size is zero,
2388 //so sdPage should renew a PresObj to process placeholder.
2389 bEmptyPresObj
= ( pTextObj
->Count() == 0 ) || ( pTextObj
->Count() == 1 && pTextObj
->First()->GetTextSize() == 0 );
2390 switch ( nPlaceholderId
)
2392 case PptPlaceholder::NOTESBODY
: ePresObjKind
= PresObjKind::Notes
; break;
2393 case PptPlaceholder::VERTICALTEXTTITLE
:
2396 case PptPlaceholder::TITLE
: ePresObjKind
= PresObjKind::Title
; break;
2397 case PptPlaceholder::VERTICALTEXTBODY
:
2400 case PptPlaceholder::BODY
: ePresObjKind
= PresObjKind::Outline
; break;
2401 case PptPlaceholder::CENTEREDTITLE
: ePresObjKind
= PresObjKind::Title
; break;
2402 case PptPlaceholder::SUBTITLE
: ePresObjKind
= PresObjKind::Text
; break; // PresObjKind::Outline
2406 if ( pTextObj
->Count() == 0 )
2408 switch ( nPlaceholderId
)
2410 case PptPlaceholder::MEDIACLIP
:
2411 case PptPlaceholder::OBJECT
: ePresObjKind
= PresObjKind::Object
; break;
2412 case PptPlaceholder::GRAPH
: ePresObjKind
= PresObjKind::Chart
; break;
2413 case PptPlaceholder::TABLE
: ePresObjKind
= PresObjKind::Table
; break;
2414 case PptPlaceholder::CLIPART
: ePresObjKind
= PresObjKind::Graphic
; break;
2415 case PptPlaceholder::ORGANISZATIONCHART
: ePresObjKind
= PresObjKind::OrgChart
; break;
2422 else if ( pTextObj
->GetShapeType() == mso_sptPictureFrame
)
2424 if ( !pTextObj
->Count() && dynamic_cast< const SdrGrafObj
*>( pObj
) != nullptr )
2426 bEmptyPresObj
= false;
2427 switch ( nPlaceholderId
)
2429 case PptPlaceholder::MEDIACLIP
:
2430 case PptPlaceholder::OBJECT
: ePresObjKind
= PresObjKind::Object
; break;
2431 case PptPlaceholder::GRAPH
: ePresObjKind
= PresObjKind::Chart
; break;
2432 case PptPlaceholder::TABLE
: ePresObjKind
= PresObjKind::Calc
; break;
2433 case PptPlaceholder::CLIPART
: ePresObjKind
= PresObjKind::Graphic
; break;
2434 case PptPlaceholder::ORGANISZATIONCHART
: ePresObjKind
= PresObjKind::OrgChart
; break;
2439 if ( ePresObjKind
!= PresObjKind::NONE
)
2441 if ( !bEmptyPresObj
)
2443 pPage
->InsertPresObj( pRet
, ePresObjKind
);
2447 SdrObject
* pPresObj
= pPage
->CreatePresObj( ePresObjKind
, bVertical
, pText
->GetLogicRect() );
2448 pPresObj
->SetUserCall( pPage
);
2450 SfxItemSet
aSet( pSdrModel
->GetItemPool() );
2451 ApplyAttributes( rStCtrl
, aSet
);
2452 pPresObj
->SetLogicRect(pText
->GetLogicRect());
2453 ApplyTextAnchorAttributes( *pTextObj
, aSet
);
2454 //set custom font attribute of the placeholder
2455 if ( pTextObj
->Count() == 1 )
2457 PPTParagraphObj
* pPara
= pTextObj
->First();
2458 if ( pPara
&& pPara
->GetTextSize() == 0 )
2460 if ( PPTPortionObj
* pPor
= pPara
->First() )
2462 pPor
->ApplyTo(aSet
, const_cast<SdrPowerPointImport
&>(static_cast<SdrPowerPointImport
const &>(*this)), pTextObj
->GetDestinationInstance());
2466 pPresObj
->SetMergedItemSet(aSet
);
2468 if ((m_eCurrentPageKind
!= PPT_NOTEPAGE
) && (nPlacementId
!= 0xffffffff) && pPage
->TRG_HasMasterPage())
2470 SdrObject
* pTitleObj
= static_cast<SdPage
&>(pPage
->TRG_GetMasterPage()).GetPresObj( PresObjKind::Title
);
2471 SdrObject
* pOutlineObj
= static_cast<SdPage
&>(pPage
->TRG_GetMasterPage()).GetPresObj( PresObjKind::Outline
);
2473 ::tools::Rectangle aTitleRect
;
2474 ::tools::Rectangle aOutlineRect
;
2478 aTitleRect
= pTitleObj
->GetLogicRect();
2481 aOutlineRect
= pOutlineObj
->GetLogicRect();
2482 aOutlineSize
= aOutlineRect
.GetSize();
2484 ::tools::Rectangle
aLogicRect( pPresObj
->GetLogicRect() );
2485 Size
aLogicSize( aLogicRect
.GetSize() );
2487 switch ( nPlacementId
)
2489 case 0 : // position in title area
2491 if ( aLogicRect
!= aTitleRect
)
2492 pPresObj
->SetUserCall( nullptr );
2498 if ( pSlideLayout
->eLayout
== PptSlideLayout::TITLEANDBODYSLIDE
)
2499 { // position in outline area
2500 if ( aLogicRect
!= aOutlineRect
)
2501 pPresObj
->SetUserCall( nullptr );
2503 else if ( pSlideLayout
->eLayout
== PptSlideLayout::TWOCOLUMNSANDTITLE
)
2504 { // position in outline area left
2505 if (std::abs(aLogicRect
.Left() - aOutlineRect
.Left()) > MAX_USER_MOVE
||
2506 std::abs(aLogicRect
.Top() - aOutlineRect
.Top()) > MAX_USER_MOVE
||
2507 std::abs(aLogicRect
.Bottom() - aOutlineRect
.Bottom()) > MAX_USER_MOVE
||
2508 aOutlineSize
.Width() == 0 ||
2509 static_cast<double>(aLogicSize
.Width()) / aOutlineSize
.Width() < 0.48 ||
2510 static_cast<double>(aLogicSize
.Width()) / aOutlineSize
.Width() > 0.5)
2512 pPresObj
->SetUserCall(nullptr);
2515 else if ( pSlideLayout
->eLayout
== PptSlideLayout::TWOROWSANDTITLE
)
2516 { // position in outline area top
2517 if (std::abs(aLogicRect
.Left() - aOutlineRect
.Left()) > MAX_USER_MOVE
||
2518 std::abs(aLogicRect
.Top() - aOutlineRect
.Top()) > MAX_USER_MOVE
||
2519 std::abs(aLogicRect
.Right() - aOutlineRect
.Right()) > MAX_USER_MOVE
)
2521 pPresObj
->SetUserCall( nullptr );
2524 else if (std::abs(aLogicRect
.Left() - aOutlineRect
.Left()) > MAX_USER_MOVE
||
2525 std::abs(aLogicRect
.Top() - aOutlineRect
.Top()) > MAX_USER_MOVE
)
2526 { // position in outline area top left
2527 pPresObj
->SetUserCall( nullptr );
2534 if ( pSlideLayout
->eLayout
== PptSlideLayout::TWOCOLUMNSANDTITLE
)
2535 { // position in outline area right
2536 if (std::abs(aLogicRect
.Right() - aOutlineRect
.Right()) > MAX_USER_MOVE
||
2537 std::abs(aLogicRect
.Top() - aOutlineRect
.Top()) > MAX_USER_MOVE
||
2538 std::abs(aLogicRect
.Bottom() - aOutlineRect
.Bottom()) > MAX_USER_MOVE
||
2539 aOutlineSize
.Width() == 0 ||
2540 static_cast<double>(aLogicSize
.Width()) / aOutlineSize
.Width() < 0.48 ||
2541 static_cast<double>(aLogicSize
.Width()) / aOutlineSize
.Width() > 0.5)
2543 pPresObj
->SetUserCall( nullptr );
2546 else if ( pSlideLayout
->eLayout
== PptSlideLayout::TWOROWSANDTITLE
)
2547 { // position in outline area bottom
2548 if (std::abs(aLogicRect
.Left() - aOutlineRect
.Left()) > MAX_USER_MOVE
||
2549 std::abs(aLogicRect
.Bottom() - aOutlineRect
.Bottom()) > MAX_USER_MOVE
||
2550 std::abs(aLogicRect
.Right() - aOutlineRect
.Right()) > MAX_USER_MOVE
)
2552 pPresObj
->SetUserCall( nullptr );
2555 else if (std::abs(aLogicRect
.Right() - aOutlineRect
.Right()) > MAX_USER_MOVE
||
2556 std::abs(aLogicRect
.Top() - aOutlineRect
.Top()) > MAX_USER_MOVE
)
2557 { // position in outline area top right
2558 pPresObj
->SetUserCall(nullptr);
2564 { // position in outline area bottom left
2565 if (std::abs(aLogicRect
.Left() - aOutlineRect
.Left()) > MAX_USER_MOVE
||
2566 std::abs(aLogicRect
.Bottom() - aOutlineRect
.Bottom()) > MAX_USER_MOVE
)
2568 pPresObj
->SetUserCall( nullptr );
2574 { // position in outline area bottom right
2575 if (std::abs(aLogicRect
.Right() - aOutlineRect
.Right()) > MAX_USER_MOVE
||
2576 std::abs(aLogicRect
.Bottom() - aOutlineRect
.Bottom()) > MAX_USER_MOVE
)
2578 pObj
->SetUserCall( nullptr );
2584 pRet
= nullptr; // return zero cause this obj was already inserted by CreatePresObj
2587 else if ( !pTextObj
->Count() )
2592 if ( pRet
!= pText
)
2594 SdrObject
* pFree( pText
);
2595 SdrObject::Free( pFree
);
2600 SdrObject
* ImplSdPPTImport::ProcessObj( SvStream
& rSt
, DffObjData
& rData
, SvxMSDffClientData
& rClientData
, ::tools::Rectangle
& rTextRect
, SdrObject
* pRet
)
2602 SdrObject
* pObj
= SdrPowerPointImport::ProcessObj( rSt
, rData
, rClientData
, rTextRect
, pRet
);
2604 // read animation effect of object
2607 // further setup placeholder objects
2608 if (dynamic_cast<const SdrPageObj
*>(pObj
))
2610 const ProcessData
& rProcessData
=static_cast<const ProcessData
&>(rClientData
);
2611 if(rProcessData
.pPage
.page
)
2612 static_cast<SdPage
*>(rProcessData
.pPage
.page
)->InsertPresObj(
2613 pObj
, PresObjKind::Page
);
2616 DffRecordHeader aMasterShapeHd
;
2618 if ( maShapeRecords
.SeekToContent( rSt
, DFF_msofbtClientData
, SEEK_FROM_CURRENT_AND_RESTART
) )
2620 bool bInhabitanceChecked
= false;
2621 bool bAnimationInfoFound
= false;
2623 DffRecordHeader
& rHdClientData
= *maShapeRecords
.Current();
2626 sal_uInt32 nClientDataLen
= SanitizeEndPos(rSt
, rHdClientData
.GetRecEndFilePos());
2627 DffRecordHeader aHd
;
2630 ReadDffRecordHeader( rSt
, aHd
);
2631 sal_uInt32 nHdRecEnd
= aHd
.GetRecEndFilePos();
2632 switch ( aHd
.nRecType
)
2634 case PPT_PST_AnimationInfo
:
2636 DffRecordHeader aHdAnimInfoAtom
;
2637 if ( SeekToRec( rSt
, PPT_PST_AnimationInfoAtom
, nHdRecEnd
, &aHdAnimInfoAtom
) )
2639 // read data from stream
2640 Ppt97AnimationPtr pAnimation
= std::make_shared
<Ppt97Animation
>( rSt
);
2641 // store animation information
2642 if( pAnimation
->HasEffect() )
2644 // translate color to RGB
2645 pAnimation
->SetDimColor( MSO_CLR_ToColor(pAnimation
->GetDimColor()) );
2646 // translate sound bits to file url
2647 if( pAnimation
->HasSoundEffect() )
2648 pAnimation
->SetSoundFileUrl( ReadSound( pAnimation
->GetSoundRef() ) );
2650 bool bDontAnimateInvisibleShape
= false;
2652 SdrTextObj
* pTextObj
= dynamic_cast<SdrTextObj
*>(pObj
);
2654 if( pTextObj
&& pTextObj
->HasText() &&
2655 dynamic_cast< SdrObjGroup
*>( pObj
) == nullptr &&
2656 pAnimation
->HasAnimateAssociatedShape() )
2658 const SfxItemSet
& rObjItemSet
= pObj
->GetMergedItemSet();
2660 drawing::FillStyle eFillStyle
= rObjItemSet
.Get(XATTR_FILLSTYLE
).GetValue();
2661 drawing::LineStyle eLineStyle
= rObjItemSet
.Get(XATTR_LINESTYLE
).GetValue();
2663 if ( ( eFillStyle
== drawing::FillStyle_NONE
) && ( eLineStyle
== drawing::LineStyle_NONE
) )
2664 bDontAnimateInvisibleShape
= true;
2667 if( bDontAnimateInvisibleShape
)
2668 pAnimation
->SetAnimateAssociatedShape(false);
2670 //maybe some actions necessary to ensure that animations on master pages are played before animations on normal pages
2671 //maybe todo in future: bool bIsEffectOnMasterPage = !bInhabitanceChecked;?
2673 maAnimations
[pObj
] = pAnimation
;
2675 bAnimationInfoFound
= true;
2680 case PPT_PST_InteractiveInfo
:
2682 sal_uInt32 nOldFilePos2
= rSt
.Tell();
2683 OUString aMacroName
;
2685 if(SeekToRec( rSt
, PPT_PST_CString
, nHdRecEnd
) )
2686 ReadString(aMacroName
);
2688 rSt
.Seek( nOldFilePos2
);
2689 DffRecordHeader aHdInteractiveInfoAtom
;
2690 if ( SeekToRec( rSt
, PPT_PST_InteractiveInfoAtom
, nHdRecEnd
, &aHdInteractiveInfoAtom
) )
2692 PptInteractiveInfoAtom aInteractiveInfoAtom
;
2693 ReadPptInteractiveInfoAtom( rSt
, aInteractiveInfoAtom
);
2695 // interactive object
2696 SdAnimationInfo
* pInfo
= SdDrawDocument::GetShapeUserData(*pObj
, true);
2698 FillSdAnimationInfo( pInfo
, &aInteractiveInfoAtom
, aMacroName
);
2699 if ( aInteractiveInfoAtom
.nAction
== 6 ) // Sj -> media action
2701 rHdClientData
.SeekToContent( rStCtrl
);
2702 DffRecordHeader aObjRefAtomHd
;
2703 if ( SeekToRec( rSt
, PPT_PST_ExObjRefAtom
, nHdRecEnd
, &aObjRefAtomHd
) )
2706 rSt
.ReadUInt32( nRef
);
2707 OUString
aMediaURL( ReadMedia( nRef
) );
2708 if ( aMediaURL
.isEmpty() )
2709 aMediaURL
= ReadSound( nRef
);
2710 if ( !aMediaURL
.isEmpty() )
2712 SdrMediaObj
* pMediaObj
= new SdrMediaObj(
2713 pObj
->getSdrModelFromSdrObject(),
2714 pObj
->GetSnapRect());
2715 pMediaObj
->SetMergedItemSet( pObj
->GetMergedItemSet() );
2717 //--remove object from maAnimations list and add the new object instead
2718 Ppt97AnimationPtr pAnimation
;
2720 tAnimationMap::iterator aFound
= maAnimations
.find( pObj
);
2721 if( aFound
!= maAnimations
.end() )
2723 pAnimation
= (*aFound
).second
;
2724 maAnimations
.erase(aFound
);
2726 maAnimations
[pMediaObj
] = pAnimation
;
2729 SdrObject::Free( pObj
);
2730 pObj
= pMediaObj
; // SJ: hoping that pObj is not inserted in any list
2731 pMediaObj
->setURL( aMediaURL
, ""/*TODO?*/ );
2739 if (!aHd
.SeekToEndOfRecord(rSt
))
2742 while( ( rSt
.GetError() == ERRCODE_NONE
) && ( rSt
.Tell() < nClientDataLen
) );
2744 if ( bInhabitanceChecked
|| bAnimationInfoFound
)
2746 bInhabitanceChecked
= true;
2747 if ( ! ( IsProperty( DFF_Prop_hspMaster
) && SeekToShape( rSt
, &rClientData
, GetPropertyValue( DFF_Prop_hspMaster
, 0 ) ) ) )
2749 ReadDffRecordHeader( rSt
, aMasterShapeHd
);
2750 if ( !SeekToRec( rSt
, DFF_msofbtClientData
, aMasterShapeHd
.GetRecEndFilePos(), &aMasterShapeHd
) )
2752 aMasterShapeHd
.SeekToContent( rSt
);
2753 rHdClientData
= aMasterShapeHd
;
2761 ImplSdPPTImport::ReadFormControl( tools::SvRef
<SotStorage
>& rSrc1
, css::uno::Reference
< css::form::XFormComponent
> & rFormComp
) const
2763 uno::Reference
< frame::XModel
> xModel
;
2764 if ( mpDoc
->GetDocSh() )
2766 xModel
= mpDoc
->GetDocSh()->GetModel();
2767 oox::ole::MSConvertOCXControls
aCtrlImporter( xModel
);
2768 return aCtrlImporter
.ReadOCXStorage( rSrc1
, rFormComp
);
2773 // exported function
2774 extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool
ImportPPT(
2775 SdDrawDocument
* pDocument
, SvStream
& rDocStream
, SotStorage
& rStorage
, SfxMedium
& rMedium
)
2777 std::unique_ptr
<SdPPTImport
> pImport( new SdPPTImport( pDocument
, rDocStream
, rStorage
, rMedium
));
2778 return pImport
->Import();
2781 extern "C" SAL_DLLPUBLIC_EXPORT
bool TestImportPPT(SvStream
&rStream
)
2786 tools::SvRef
<SotStorage
> xStorage(new SotStorage(rStream
));
2787 if (xStorage
->GetError())
2790 tools::SvRef
<SotStorageStream
> xDocStream(xStorage
->OpenSotStream( "PowerPoint Document", StreamMode::STD_READ
));
2791 if ( !xDocStream
.is() )
2796 SfxMedium
aSrcMed("", StreamMode::STD_READ
);
2798 xDocStream
->SetVersion(xStorage
->GetVersion());
2799 xDocStream
->SetCryptMaskKey(xStorage
->GetKey());
2801 ::sd::DrawDocShellRef xDocShRef
= new ::sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED
, false, DocumentType::Impress
);
2802 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
2806 bRet
= ImportPPT(pDoc
, *xDocStream
, *xStorage
, aSrcMed
);
2812 xDocShRef
->DoClose();
2820 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */