LibreOffice Module filter (master) 1
svdfppt.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21
22#include <osl/endian.h>
23#include <utility>
24#include <vcl/svapp.hxx>
25#include <unotools/tempfile.hxx>
28#include <editeng/eeitem.hxx>
29#include <editeng/editdata.hxx>
30#include <sot/storage.hxx>
31#include <sot/storinfo.hxx>
32#include <sot/stg.hxx>
33#include <com/sun/star/embed/Aspects.hpp>
34#include <com/sun/star/embed/XEmbeddedObject.hpp>
35#include <com/sun/star/frame/XModel.hpp>
36#include <com/sun/star/office/XAnnotation.hpp>
37#include <com/sun/star/office/XAnnotationAccess.hpp>
38#include <com/sun/star/text/XText.hpp>
39#include <com/sun/star/geometry/RealPoint2D.hpp>
40#include <com/sun/star/util/DateTime.hpp>
41#include <com/sun/star/drawing/BitmapMode.hpp>
43#include <svx/xflgrit.hxx>
44#include <svx/xbtmpit.hxx>
45#include <svx/svdtrans.hxx>
46#include <svx/svdmodel.hxx>
47#include <svx/svdpage.hxx>
48#include <svx/svdobj.hxx>
49#include <svx/svdogrp.hxx>
50#include <svx/svdorect.hxx>
51#include <svx/svdopage.hxx>
52#include <svx/svdograf.hxx>
53#include <svx/svdopath.hxx>
54#include <svx/svdotable.hxx>
55#include <svx/xfillit0.hxx>
56#include <svx/xflbstit.hxx>
57#include <svx/xflbmtit.hxx>
58#include <svx/xflclit.hxx>
59#include <svx/xfltrit.hxx>
60#include <editeng/outlobj.hxx>
61#include <editeng/numdef.hxx>
62#include <svx/sdasitm.hxx>
63#include <svx/sdmetitm.hxx>
64#include <svx/sdtagitm.hxx>
65#include <svx/sdtditm.hxx>
66#include <svx/sdtfsitm.hxx>
67#include <svx/sdtmfitm.hxx>
68#include <svx/xlineit0.hxx>
69#include <svx/xlnclit.hxx>
70#include <svx/xlnwtit.hxx>
73#include <svx/svdoashp.hxx>
74#include <editeng/tstpitem.hxx>
75#include <editeng/editids.hrc>
76
79#include <editeng/colritem.hxx>
80#include <editeng/fhgtitem.hxx>
81#include <editeng/wghtitem.hxx>
82#include <editeng/postitem.hxx>
83#include <editeng/udlnitem.hxx>
85#include <editeng/shdditem.hxx>
87#include <editeng/fontitem.hxx>
88#include <svx/svdoutl.hxx>
89#include <editeng/lspcitem.hxx>
90#include <editeng/ulspitem.hxx>
91#include <editeng/lrspitem.hxx>
92#include <editeng/numitem.hxx>
93#include <vcl/gdimtf.hxx>
95#include <svx/svditer.hxx>
96#include <editeng/flditem.hxx>
97#include <tools/zcodec.hxx>
99#include <sfx2/objsh.hxx>
100#include <editeng/brushitem.hxx>
101#include <editeng/langitem.hxx>
102#include <svx/svdoole2.hxx>
104#include <com/sun/star/container/XIndexContainer.hpp>
105#include <com/sun/star/drawing/XControlShape.hpp>
106#include <com/sun/star/form/XFormComponent.hpp>
107#include <com/sun/star/beans/XPropertySet.hpp>
108#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
109#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
110#include <com/sun/star/awt/Size.hpp>
111#include <com/sun/star/drawing/FillStyle.hpp>
112#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
113#include <editeng/frmdiritem.hxx>
114#include <svx/sdtfchim.hxx>
115#include <com/sun/star/awt/Gradient.hpp>
116#include <com/sun/star/table/XMergeableCellRange.hpp>
117#include <com/sun/star/table/BorderLine2.hpp>
118#include <com/sun/star/table/BorderLineStyle.hpp>
119#include <com/sun/star/lang/XMultiServiceFactory.hpp>
120#include <svtools/embedhlp.hxx>
121#include <o3tl/enumrange.hxx>
122#include <o3tl/safeint.hxx>
123#include <o3tl/sorted_vector.hxx>
124#include <sal/log.hxx>
125
126#include <algorithm>
127#include <cassert>
128#include <rtl/strbuf.hxx>
129#include <tools/time.hxx>
130#include <memory>
131
132// PPT ColorScheme Slots
133#define PPT_COLSCHEME (0x08000000)
134#define PPT_COLSCHEME_HINTERGRUND (0x08000000)
135#define PPT_COLSCHEME_TEXT_UND_ZEILEN (0x08000001)
136#define PPT_COLSCHEME_TITELTEXT (0x08000003)
137#define PPT_COLSCHEME_A_UND_HYPERLINK (0x08000006)
138
139#define ANSI_CHARSET 0
140#define SYMBOL_CHARSET 2
141
142/* Font Families */
143#define FF_ROMAN 0x10
144#define FF_SWISS 0x20
145#define FF_MODERN 0x30
146#define FF_SCRIPT 0x40
147#define FF_DECORATIVE 0x50
148
149#define DEFAULT_PITCH 0x00
150#define FIXED_PITCH 0x01
151#define VARIABLE_PITCH 0x02
152
153using namespace ::com::sun::star ;
154using namespace uno ;
155using namespace beans ;
156using namespace drawing ;
157using namespace container ;
158using namespace table ;
159
161 rDocStream ( rDocStrm ),
162 nImportFlags ( 0 )
163{
164}
165
167{
168 DffRecordHeader aHd;
169 ReadDffRecordHeader( rIn, aHd );
171 {
172 sal_uInt32 nLen;
173 sal_uInt16 nUserNameLen(0), nPad;
174 rIn.ReadUInt32( nLen )
175 .ReadUInt32( rAtom.nMagic )
177 .ReadUInt16( nUserNameLen )
179 .ReadUChar( rAtom.nMajorVersion )
180 .ReadUChar( rAtom.nMinorVersion )
181 .ReadUInt16( nPad );
182 rAtom.aCurrentUser = SvxMSDffManager::MSDFFReadZString( rIn, nUserNameLen, true );
183 }
184 aHd.SeekToEndOfRecord( rIn );
185 return rIn;
186}
187
189{
191}
192
194{
195 DffRecordHeader aHd;
196 ReadDffRecordHeader( rIn, aHd );
197 rIn
198 .ReadUInt32( rAtom.nPsrReference )
199 .ReadUInt32( rAtom.nFlags )
200 .ReadUInt32( rAtom.nNumberTexts )
201 .ReadUInt32( rAtom.nSlideId );
202 aHd.SeekToEndOfRecord( rIn );
203 return rIn;
204}
205
207
209
210sal_uInt16 PptSlidePersistList::FindPage(sal_uInt32 nId) const
211{
212 for ( size_t i=0; i < mvEntries.size(); i++ )
213 {
214 if (mvEntries[ i ]->GetSlideId() == nId) return i;
215 }
217}
218
220{
221 rIn.ReadUInt32( rAtom.nSoundRef )
222 .ReadUInt32( rAtom.nExHyperlinkId )
223 .ReadUChar( rAtom.nAction )
224 .ReadUChar( rAtom.nOleVerb )
225 .ReadUChar( rAtom.nJump )
226 .ReadUChar( rAtom.nFlags )
227 .ReadUChar( rAtom.nHyperlinkType )
228 .ReadUChar( rAtom.nUnknown1 )
229 .ReadUChar( rAtom.nUnknown2 )
230 .ReadUChar( rAtom.nUnknown3 );
231 return rIn.good();
232}
233
235{
236 sal_uInt32 nDummy1;
237 sal_uInt32 nDummy2;
238 sal_uInt32 nDummy4;
239
240 rIn.ReadUInt32( rAtom.nAspect )
241 .ReadUInt32( nDummy1 )
242 .ReadUInt32( rAtom.nId )
243 .ReadUInt32( nDummy2 )
244 .ReadUInt32( rAtom.nPersistPtr )
245 .ReadUInt32( nDummy4 );
246 return rIn;
247}
248
250{
251// Actual format:
252// 00 aSlidePageSizeXY 8
253// 08 aNotesPageSizeXY 8
254// 16 aZoomRatio (OLE) 8
255// 24 nNotesMasterPersist 4
256// 28 nHandoutMasterPersist 4
257// 32 n1stPageNumber 2
258// 34 ePageFormat 2
259// 36 bEmbeddedTrueType 1
260// 37 bOmitTitlePlace 1
261// 38 bRightToLeft 1
262// 39 bShowComments 1
263
264 DffRecordHeader aHd;
265 sal_Int32 nSlideX(0), nSlideY(0), nNoticeX(0), nNoticeY(0), nDummy;
266 sal_uInt16 nSlidePageFormat(0);
267 sal_Int8 nEmbeddedTrueType(0), nTitlePlaceHoldersOmitted(0), nRightToLeft(0), nShowComments(0);
268
269 ReadDffRecordHeader( rIn, aHd );
270 rIn
271 .ReadInt32( nSlideX ).ReadInt32( nSlideY )
272 .ReadInt32( nNoticeX ).ReadInt32( nNoticeY )
273 .ReadInt32( nDummy ).ReadInt32( nDummy ) // skip ZoomRatio
276 .ReadUInt16( rAtom.n1stPageNumber )
277 .ReadUInt16( nSlidePageFormat )
278 .ReadSChar( nEmbeddedTrueType )
279 .ReadSChar( nTitlePlaceHoldersOmitted )
280 .ReadSChar( nRightToLeft )
281 .ReadSChar( nShowComments );
282 // clamp dodgy data to avoid overflow in later calculations
283 const sal_Int32 nPageClamp = SAL_MAX_INT32/5;
284 rAtom.aSlidesPageSize.setWidth( std::clamp<sal_Int32>(nSlideX, -nPageClamp, nPageClamp) );
285 rAtom.aSlidesPageSize.setHeight( std::clamp<sal_Int32>(nSlideY, -nPageClamp, nPageClamp) );
286 const sal_Int32 nNoteClamp = 65536;
287 rAtom.aNotesPageSize.setWidth( std::clamp<sal_Int32>(nNoticeX, -nNoteClamp, nNoteClamp) );
288 rAtom.aNotesPageSize.setHeight( std::clamp<sal_Int32>(nNoticeY, -nNoteClamp, nNoteClamp) );
289 rAtom.eSlidesPageFormat = static_cast<PptPageFormat>(nSlidePageFormat);
290 rAtom.bEmbeddedTrueType = nEmbeddedTrueType;
291 rAtom.bTitlePlaceholdersOmitted = nTitlePlaceHoldersOmitted;
292 rAtom.bRightToLeft = nRightToLeft;
293 rAtom.bShowComments = nShowComments;
294 aHd.SeekToEndOfRecord( rIn );
295 return rIn;
296}
297
299{
303}
304
306{
307 sal_Int32 nTmp;
308 rIn.ReadInt32(nTmp);
309 rAtom.eLayout = static_cast<PptSlideLayout>(nTmp);
310 static_assert(sizeof(rAtom.aPlaceholderId) == 8, "wrong size of serialized array");
311 rIn.ReadBytes(rAtom.aPlaceholderId, 8);
312 return rIn;
313}
314
316{
317 DffRecordHeader aHd;
318 ReadDffRecordHeader( rIn, aHd );
319 ReadPptSlideLayoutAtom( rIn, rAtom.aLayout );
320 rIn.ReadUInt32( rAtom.nMasterId )
321 .ReadUInt32( rAtom.nNotesId )
322 .ReadUInt16( rAtom.nFlags );
323 aHd.SeekToEndOfRecord( rIn );
324 return rIn;
325}
326
328{
329 nMasterId = nNotesId = 0;
330 nFlags = 0;
331}
332
334{
335 DffRecordHeader aHd;
336 ReadDffRecordHeader( rIn, aHd );
337 rIn
338 .ReadUInt32( rAtom.nSlideId )
339 .ReadUInt16( rAtom.nFlags );
340 aHd.SeekToEndOfRecord( rIn );
341 return rIn;
342}
343
345{
346 nSlideId = 0;
347 nFlags = 0;
348}
349
351{
352}
353
354Color PptColorSchemeAtom::GetColor( sal_uInt16 nNum ) const
355{
356 Color aRetval;
357 if ( nNum < 8 )
358 {
359 nNum <<= 2;
360 aRetval.SetRed( aData[ nNum++ ] );
361 aRetval.SetGreen( aData[ nNum++ ] );
362 aRetval.SetBlue( aData[ nNum++ ] );
363 }
364 return aRetval;
365}
366
368{
369 DffRecordHeader aHd;
370 ReadDffRecordHeader( rIn, aHd );
371 rIn.ReadBytes(rAtom.aData, 32);
372 aHd.SeekToEndOfRecord( rIn );
373 return rIn;
374}
375
377{
378 DffRecordHeader aHd;
379 ReadDffRecordHeader( rIn, aHd );
380 sal_Unicode nTemp, cData[ 32 ];
381 rIn.ReadBytes(cData, 64);
382
383 sal_uInt8 lfCharset, lfPitchAndFamily;
384
385 rIn.ReadUChar( lfCharset )
386 .ReadUChar( rAtom.lfClipPrecision )
387 .ReadUChar( rAtom.lfQuality )
388 .ReadUChar( lfPitchAndFamily );
389
390 switch( lfCharset )
391 {
392 case SYMBOL_CHARSET :
393 rAtom.eCharSet = RTL_TEXTENCODING_SYMBOL;
394 break;
395 case ANSI_CHARSET :
396 rAtom.eCharSet = RTL_TEXTENCODING_MS_1252;
397 break;
398
399 default :
400 rAtom.eCharSet = osl_getThreadTextEncoding();
401 }
402 switch ( lfPitchAndFamily & 0xf0 )
403 {
404 case FF_ROMAN:
405 rAtom.eFamily = FAMILY_ROMAN;
406 break;
407
408 case FF_SWISS:
409 rAtom.eFamily = FAMILY_SWISS;
410 break;
411
412 case FF_MODERN:
413 rAtom.eFamily = FAMILY_MODERN;
414 break;
415
416 case FF_SCRIPT:
417 rAtom.eFamily = FAMILY_SCRIPT;
418 break;
419
420 case FF_DECORATIVE:
422 break;
423
424 default:
425 rAtom.eFamily = FAMILY_DONTKNOW;
426 break;
427 }
428
429 switch ( lfPitchAndFamily & 0x0f )
430 {
431 case FIXED_PITCH:
432 rAtom.ePitch = PITCH_FIXED;
433 break;
434
435 case DEFAULT_PITCH:
436 case VARIABLE_PITCH:
437 default:
438 rAtom.ePitch = PITCH_VARIABLE;
439 break;
440 }
441 sal_uInt16 i;
442 for ( i = 0; i < 32; i++ )
443 {
444 nTemp = cData[ i ];
445 if ( !nTemp )
446 break;
447#ifdef OSL_BIGENDIAN
448 cData[ i ] = ( nTemp >> 8 ) | ( nTemp << 8 );
449#endif
450 }
451 rAtom.aName = OUString(cData, i);
453 rAtom.bAvailable = pDev->IsFontAvailable( rAtom.aName );
454 aHd.SeekToEndOfRecord( rIn );
455 return rIn;
456}
457
459{
460 sal_Int16 lastViewType = 0;
461 ReadDffRecordHeader( rIn, rAtom.aHd );
462 rIn
463 .ReadInt32( rAtom.nLastSlideID )
464 .ReadUInt32( rAtom.nVersion )
467 .ReadUInt32( rAtom.nDocumentRef )
469 .ReadInt16( lastViewType );
470 rAtom.eLastViewType = static_cast<PptViewTypeEnum>(lastViewType);
471 rAtom.aHd.SeekToEndOfRecord(rIn);
472 return rIn;
473}
474
476{
477 nPlacementId = 0;
480}
481
483{
484 rIn.ReadUInt32( rAtom.nPlacementId );
485 sal_uInt8 nTmp(0);
486 rIn.ReadUChar(nTmp);
487 rAtom.nPlaceholderId = static_cast<PptPlaceholder>(nTmp);
488 rIn.ReadUChar( rAtom.nPlaceholderSize );
489 return rIn;
490}
491
493 nSlidePersistStartOffset( 0 ),
494 nSlidePersistEndOffset ( 0 ),
495 nBackgroundOffset ( 0 ),
496 nDrawingDgId ( 0xffffffff ),
497 ePageKind ( PPT_MASTERPAGE ),
498 bNotesMaster ( false ),
499 bHandoutMaster ( false ),
500 bStarDrawFiller ( false )
501{
502 HeaderFooterOfs[ 0 ] = HeaderFooterOfs[ 1 ] = HeaderFooterOfs[ 2 ] = HeaderFooterOfs[ 3 ] = 0;
503}
504
506{
507}
508
509SdrEscherImport::SdrEscherImport( PowerPointImportParam& rParam, const OUString& rBaseURL ) :
510 SvxMSDffManager ( rParam.rDocStream, rBaseURL ),
511 nStreamLen ( 0 ),
512 rImportParam ( rParam )
513{
514}
515
517{
518}
519
521{
522 return nullptr;
523}
524
525bool SdrEscherImport::ReadString( OUString& rStr ) const
526{
527 bool bRet = false;
528 DffRecordHeader aStrHd;
529 ReadDffRecordHeader( rStCtrl, aStrHd );
530 if (aStrHd.nRecType == PPT_PST_TextBytesAtom
532 || aStrHd.nRecType == PPT_PST_CString)
533 {
534 bool bUniCode =
536 || aStrHd.nRecType == PPT_PST_CString);
537 sal_uLong nBytes = aStrHd.nRecLen;
538 rStr = MSDFFReadZString( rStCtrl, nBytes, bUniCode );
539 bRet = aStrHd.SeekToEndOfRecord( rStCtrl );
540 }
541 else
542 aStrHd.SeekToBegOfRecord( rStCtrl );
543 return bRet;
544}
545
546bool SdrEscherImport::GetColorFromPalette(sal_uInt16 /*nNum*/, Color& /*rColor*/) const
547{
548 return false;
549}
550
551bool SdrEscherImport::SeekToShape( SvStream& /*rSt*/, SvxMSDffClientData* /*pClientData*/, sal_uInt32 /*nId*/) const
552{
553 return false;
554}
555
557{
558 if (m_xFonts && nNum < m_xFonts->size())
559 return &(*m_xFonts)[ nNum ];
560 return nullptr;
561}
562
564{
565 return pObj;
566}
567
569{
570 sal_Int32 l, t, r, b;
571 if ( rHd.nRecLen == 16 )
572 {
573 rSt.ReadInt32( l ).ReadInt32( t ).ReadInt32( r ).ReadInt32( b );
574 }
575 else
576 {
577 sal_Int16 ls, ts, rs, bs;
578 rSt.ReadInt16( ts ).ReadInt16( ls ).ReadInt16( rs ).ReadInt16( bs ); // the order of coordinates is a bit strange...
579 l = ls;
580 t = ts;
581 r = rs;
582 b = bs;
583 }
584 if (!rSt.good())
585 {
586 SAL_WARN("filter.ms", "ProcessClientAnchor2: short read");
587 return;
588 }
589 Scale( l );
590 Scale( t );
591 Scale( r );
592 Scale( b );
593 rObj.aChildAnchor = tools::Rectangle( l, t, r, b );
594 rObj.bChildAnchor = true;
595};
596
597void SdrEscherImport::RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraphic )
598{
599 if ( rGraphic.GetType() != GraphicType::GdiMetafile )
600 return;
601
602 sal_uInt16 nX, nGlobalColorsCount, nFillColorsCount;
603
604 rSt.ReadUInt16( nX )
605 .ReadUInt16( nGlobalColorsCount )
606 .ReadUInt16( nFillColorsCount )
607 .ReadUInt16( nX )
608 .ReadUInt16( nX )
609 .ReadUInt16( nX );
610
611 if ( ( nGlobalColorsCount > 64 ) || ( nFillColorsCount > 64 ) )
612 return;
613
614 if ( static_cast<sal_uInt32>( ( nGlobalColorsCount + nFillColorsCount ) * 44 + 12 ) != nRecLen )
615 return;
616
617 sal_uInt32 OriginalGlobalColors[ 64 ];
618 sal_uInt32 NewGlobalColors[ 64 ];
619
620 sal_uInt32 i, j, nGlobalColorsChanged, nFillColorsChanged;
621 nGlobalColorsChanged = nFillColorsChanged = 0;
622
623 sal_uInt32* pCurrentOriginal = OriginalGlobalColors;
624 sal_uInt32* pCurrentNew = NewGlobalColors;
625 sal_uInt32* pCount = &nGlobalColorsChanged;
626 i = nGlobalColorsCount;
627
628 for ( j = 0; j < 2; j++ )
629 {
630 for ( ; i > 0; i-- )
631 {
632 sal_uInt64 nPos = rSt.Tell();
633 sal_uInt16 nChanged;
634 rSt.ReadUInt16( nChanged );
635 if ( nChanged & 1 )
636 {
637 sal_uInt8 nDummy, nRed, nGreen, nBlue;
638 sal_uInt32 nColor = 0;
639 sal_uInt32 nIndex;
640 rSt.ReadUChar( nDummy )
641 .ReadUChar( nRed )
642 .ReadUChar( nDummy )
643 .ReadUChar( nGreen )
644 .ReadUChar( nDummy )
645 .ReadUChar( nBlue )
646 .ReadUInt32( nIndex );
647
648 if ( nIndex < 8 )
649 {
650 Color aColor = MSO_CLR_ToColor( nIndex << 24 );
651 nRed = aColor.GetRed();
652 nGreen = aColor.GetGreen();
653 nBlue = aColor.GetBlue();
654 }
655 nColor = nRed | ( nGreen << 8 ) | ( nBlue << 16 );
656 *pCurrentNew++ = nColor;
657 rSt.ReadUChar( nDummy )
658 .ReadUChar( nRed )
659 .ReadUChar( nDummy )
660 .ReadUChar( nGreen )
661 .ReadUChar( nDummy )
662 .ReadUChar( nBlue );
663 nColor = nRed | ( nGreen << 8 ) | ( nBlue << 16 );
664 *pCurrentOriginal++ = nColor;
665 (*pCount)++;
666 }
667 rSt.Seek( nPos + 44 );
668 }
669 pCount = &nFillColorsChanged;
670 i = nFillColorsCount;
671 }
672 if ( !(nGlobalColorsChanged || nFillColorsChanged) )
673 return;
674
675 std::unique_ptr<Color[]> pSearchColors(new Color[ nGlobalColorsChanged ]);
676 std::unique_ptr<Color[]> pReplaceColors(new Color[ nGlobalColorsChanged ]);
677
678 for ( j = 0; j < nGlobalColorsChanged; j++ )
679 {
680 sal_uInt32 nSearch = OriginalGlobalColors[ j ];
681 sal_uInt32 nReplace = NewGlobalColors[ j ];
682
683 pSearchColors[ j ].SetRed( static_cast<sal_uInt8>(nSearch) );
684 pSearchColors[ j ].SetGreen( static_cast<sal_uInt8>( nSearch >> 8 ) );
685 pSearchColors[ j ].SetBlue( static_cast<sal_uInt8>( nSearch >> 16 ) );
686
687 pReplaceColors[ j ].SetRed( static_cast<sal_uInt8>(nReplace) );
688 pReplaceColors[ j ].SetGreen( static_cast<sal_uInt8>( nReplace >> 8 ) );
689 pReplaceColors[ j ].SetBlue( static_cast<sal_uInt8>( nReplace >> 16 ) );
690 }
691 GDIMetaFile aGdiMetaFile( rGraphic.GetGDIMetaFile() );
692 aGdiMetaFile.ReplaceColors( pSearchColors.get(), pReplaceColors.get(),
693 nGlobalColorsChanged );
694 rGraphic = aGdiMetaFile;
695}
696
698{
699 auto nStreamLen = rIn.Tell() + rIn.remainingSize();
700 if (nEndRecPos > nStreamLen)
701 {
702 SAL_WARN("filter.ms", "Parsing error: " << nStreamLen <<
703 " max end pos, but " << nEndRecPos << " claimed, truncating");
704 nEndRecPos = nStreamLen;
705 }
706 return nEndRecPos;
707}
708
710{
712 {
713 for (auto & pPtr : rPersistEntry.xSolverContainer->aCList)
714 {
715 if (pPtr->pAObj == pObj)
716 pPtr->pAObj = nullptr;
717 if (pPtr->pBObj == pObj)
718 pPtr->pBObj = nullptr;
719 if (pPtr->pCObj == pObj)
720 pPtr->pCObj = nullptr;
721 }
722 }
723}
724
725/* ProcessObject is called from ImplSdPPTImport::ProcessObj to handle all application specific things,
726 such as the import of text, animation effects, header footer and placeholder.
727
728 The parameter pOriginalObj is the object as it was imported by our general escher import, it must either
729 be deleted or it can be returned to be inserted into the sdr page.
730*/
732{
733 if ( dynamic_cast<const SdrObjCustomShape* >(pOriginalObj) != nullptr )
734 pOriginalObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
735
736 // we are initializing our return value with the object that was imported by our escher import
737 rtl::Reference<SdrObject> pRet = pOriginalObj;
738
739 ProcessData& rData = static_cast<ProcessData&>(rClientData);
740 PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry;
741
742 if ( ! (rObjData.nSpFlags & ShapeFlag::Group) ) // sj: #114758# ...
743 {
744 PptOEPlaceholderAtom aPlaceholderAtom;
745
747 {
748 sal_Int16 nHeaderFooterInstance = -1;
749 DffRecordHeader aClientDataHd;
750 auto nEndRecPos = SanitizeEndPos(rSt, maShapeRecords.Current()->GetRecEndFilePos());
751 while ( ( rSt.GetError() == ERRCODE_NONE ) && ( rSt.Tell() < nEndRecPos ) )
752 {
753 ReadDffRecordHeader( rSt, aClientDataHd );
754 switch ( aClientDataHd.nRecType )
755 {
756 // importing header/footer object from master page
758 {
759 ReadPptOEPlaceholderAtom( rSt, aPlaceholderAtom );
760 if ( nHeaderFooterInstance == -1 )
761 {
762 switch ( aPlaceholderAtom.nPlaceholderId )
763 {
764 case PptPlaceholder::MASTERSLIDENUMBER : nHeaderFooterInstance++;
765 [[fallthrough]];
766 case PptPlaceholder::MASTERFOOTER : nHeaderFooterInstance++;
767 [[fallthrough]];
768 case PptPlaceholder::MASTERHEADER : nHeaderFooterInstance++;
769 [[fallthrough]];
770 case PptPlaceholder::MASTERDATE : nHeaderFooterInstance++; break;
771 default: break;
772
773 }
774 if ( ! ( nHeaderFooterInstance & 0xfffc ) ) // is this a valid instance ( 0->3 )
775 rPersistEntry.HeaderFooterOfs[ nHeaderFooterInstance ] = rObjData.rSpHd.GetRecBegFilePos();
776 }
777 }
778 break;
779
781 {
782 if ( auto pSdrGrafObj = dynamic_cast<SdrGrafObj* >(pRet.get()) )
783 if ( pSdrGrafObj->HasGDIMetaFile() )
784 {
785 Graphic aGraphic( pSdrGrafObj->GetGraphic() );
786 RecolorGraphic( rSt, aClientDataHd.nRecLen, aGraphic );
787 pSdrGrafObj->SetGraphic( aGraphic );
788 }
789 }
790 break;
791 }
792 if (!aClientDataHd.SeekToEndOfRecord(rSt))
793 break;
794 }
795 }
796 if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE ) && !rPersistEntry.bNotesMaster )
797 {
798 sal_uInt16 nPageNum = pSdrModel->GetPageCount();
799 if ( nPageNum > 0 )
800 nPageNum--;
801
802 // replacing the object which we will return with a SdrPageObj
803 pRet = new SdrPageObj(
804 *pSdrModel,
805 rObjData.aBoundRect,
806 pSdrModel->GetPage(nPageNum - 1));
807 }
808 else
809 {
810 // try to load some ppt text
811 PPTTextObj aTextObj( rSt, static_cast<SdrPowerPointImport&>(*this), rPersistEntry, &rObjData );
812 if ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() )
813 {
814 bool bVerticalText = false;
815 // and if the text object is not empty, it must be applied to pRet, the object we
816 // initially got from our escher import
817 Degree100 nTextRotationAngle(0);
819 {
820 auto eTextFlow = GetPropertyValue(DFF_Prop_txflTextFlow, 0) & 0xFFFF;
821 switch( eTextFlow )
822 {
823 case mso_txflBtoT : // Bottom to Top non-@
824 nTextRotationAngle += 9000_deg100;
825 break;
826 case mso_txflTtoBA : /* #68110# */ // Top to Bottom @-font
827 case mso_txflTtoBN : // Top to Bottom non-@
828 case mso_txflVertN : // Vertical, non-@, top to bottom
829 bVerticalText = !bVerticalText; // nTextRotationAngle += 27000;
830 break;
831 // case mso_txflHorzN : // Horizontal non-@, normal
832 // case mso_txflHorzA : // Horizontal @-font, normal
833 default: break;
834 }
835 }
836 sal_Int32 nFontDirection = GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 );
837 if ( ( nFontDirection == 1 ) || ( nFontDirection == 3 ) )
838 {
839 bVerticalText = !bVerticalText;
840 }
841 const bool bFail = o3tl::checked_multiply<sal_Int32>(nFontDirection, 9000, nFontDirection);
842 if (!bFail)
843 nTextRotationAngle -= Degree100(nFontDirection);
844 else
845 SAL_WARN("filter.ms", "Parsing error: bad fontdirection: " << nFontDirection);
846 aTextObj.SetVertical( bVerticalText );
847 if ( pRet )
848 {
849 bool bDeleteSource = aTextObj.GetOEPlaceHolderAtom().has_value();
850 if ( bDeleteSource && dynamic_cast<const SdrGrafObj* >(pRet.get()) == nullptr // we are not allowed to get
851 && dynamic_cast<const SdrObjGroup* >(pRet.get()) == nullptr // grouped placeholder objects
852 && dynamic_cast<const SdrOle2Obj* >(pRet.get()) == nullptr )
853 {
854 pRet = nullptr;
855 }
856 }
857 sal_uInt32 nTextFlags = aTextObj.GetTextFlags();
858 sal_Int32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 25 * 3600 ); // 0.25 cm (emu)
859 sal_Int32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 25 * 3600 ); // 0.25 cm (emu)
860 sal_Int32 nTextTop = GetPropertyValue( DFF_Prop_dyTextTop, 13 * 3600 ); // 0.13 cm (emu)
861 sal_Int32 nTextBottom = GetPropertyValue( DFF_Prop_dyTextBottom, 13 * 3600 );
862 ScaleEmu( nTextLeft );
863 ScaleEmu( nTextRight );
864 ScaleEmu( nTextTop );
865 ScaleEmu( nTextBottom );
866
867 sal_Int32 nMinFrameWidth = 0;
868 sal_Int32 nMinFrameHeight = 0;
869 bool bAutoGrowWidth, bAutoGrowHeight;
870
873
876
877 if ( bVerticalText )
878 {
881
882 // read text anchor
884
885 switch( eTextAnchor )
886 {
887 case mso_anchorTop:
892 break;
893
894 case mso_anchorMiddle :
897 break;
898
899 case mso_anchorBottom:
904 break;
905 }
906 switch ( eTextAnchor )
907 {
913 {
914 // check if it is sensible to use the centered alignment
916 switch (nTextFlags & nMask)
917 {
922 eTVA = SDRTEXTVERTADJUST_CENTER; // If the textobject has only one type of alignment, then the text has not to be displayed using the full width;
923 break;
924 }
925 break;
926 }
927 default:
928 break;
929 }
930 nMinFrameWidth = rTextRect.GetWidth() - ( nTextLeft + nTextRight );
931 }
932 else
933 {
936
937 // read text anchor
939
940 switch( eTextAnchor )
941 {
942 case mso_anchorTop:
947 break;
948
949 case mso_anchorMiddle :
952 break;
953
954 case mso_anchorBottom:
959 break;
960 }
961 switch ( eTextAnchor )
962 {
968 {
969 // check if it is sensible to use the centered alignment
971 switch (nTextFlags & nMask)
972 {
977 eTHA = SDRTEXTHORZADJUST_CENTER; // If the textobject has only one type of alignment, then the text has not to be displayed using the full width;
978 break;
979 }
980 break;
981 }
982 default:
983 break;
984 }
985 nMinFrameHeight = rTextRect.GetHeight() - ( nTextTop + nTextBottom );
986 }
987
988 SdrObjKind eTextKind = SdrObjKind::Rectangle;
989 if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE )
990 || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESSLIDEIMAGE ) )
991 {
992 aTextObj.SetInstance( TSS_Type::Notes );
993 eTextKind = SdrObjKind::TitleText;
994 }
995 else if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESBODYIMAGE )
996 || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESBODY ) )
997 {
998 aTextObj.SetInstance( TSS_Type::Notes );
999 eTextKind = SdrObjKind::Text;
1000 }
1001
1002 TSS_Type nDestinationInstance = aTextObj.GetInstance();
1003 if ( rPersistEntry.ePageKind == PPT_MASTERPAGE )
1004 {
1005 if ( !rPersistEntry.pPresentationObjects )
1006 {
1007 rPersistEntry.pPresentationObjects.reset( new sal_uInt32[ PPT_STYLESHEETENTRIES ] );
1008 memset( rPersistEntry.pPresentationObjects.get(), 0, PPT_STYLESHEETENTRIES * 4 );
1009 }
1010 if ( !rPersistEntry.pPresentationObjects[ static_cast<int>(nDestinationInstance) ] )
1011 rPersistEntry.pPresentationObjects[ static_cast<int>(nDestinationInstance) ] = rObjData.rSpHd.GetRecBegFilePos();
1012 }
1013 switch ( nDestinationInstance )
1014 {
1015 case TSS_Type::PageTitle :
1016 case TSS_Type::Title :
1017 {
1019 nDestinationInstance = TSS_Type::Title;
1020 else
1021 nDestinationInstance = TSS_Type::PageTitle;
1022 }
1023 break;
1024 case TSS_Type::Body :
1025 case TSS_Type::HalfBody :
1027 nDestinationInstance = TSS_Type::Body;
1028 break;
1029 default: break;
1030 }
1031 aTextObj.SetDestinationInstance( nDestinationInstance );
1032
1033 bool bAutoFit = false; // auto-scale text into shape box
1034 switch ( aTextObj.GetInstance() )
1035 {
1036 case TSS_Type::PageTitle :
1037 case TSS_Type::Title : eTextKind = SdrObjKind::TitleText; break;
1038 case TSS_Type::Subtitle : eTextKind = SdrObjKind::Text; break;
1039 case TSS_Type::Body :
1040 case TSS_Type::HalfBody :
1041 case TSS_Type::QuarterBody : eTextKind = SdrObjKind::OutlineText; bAutoFit = true; break;
1042 default: break;
1043 }
1045 {
1046 if ( !aTextObj.GetOEPlaceHolderAtom() || aTextObj.GetOEPlaceHolderAtom()->nPlaceholderId == PptPlaceholder::NONE )
1047 {
1049 eTextKind = SdrObjKind::Rectangle;
1050 }
1051 }
1054 bool bFitShapeToText = ( GetPropertyValue( DFF_Prop_FitTextToShape, 0 ) & 2 ) != 0;
1055
1056 if ( dynamic_cast<const SdrObjCustomShape* >(pRet.get()) != nullptr && ( eTextKind == SdrObjKind::Rectangle ) )
1057 {
1058 bAutoGrowHeight = bFitShapeToText;
1059 bAutoGrowWidth = !bWordWrap;
1060 pTObj = pRet;
1061 pRet = nullptr;
1062 }
1063 else
1064 {
1065 if ( dynamic_cast<const SdrObjCustomShape* >(pRet.get()) != nullptr )
1066 {
1067 pRet = nullptr;
1068 }
1069 pTObj = new SdrRectObj(
1070 *pSdrModel,
1071 eTextKind != SdrObjKind::Rectangle ? eTextKind : SdrObjKind::Text);
1072 SfxItemSet aSet( pSdrModel->GetItemPool() );
1073 if ( !pRet )
1074 ApplyAttributes( rSt, aSet, rObjData );
1075 pTObj->SetMergedItemSet( aSet );
1076 if ( pRet )
1077 {
1078 pTObj->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
1079 pTObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
1080 }
1081 if ( bVerticalText )
1082 {
1083 bAutoGrowWidth = bFitShapeToText;
1084 bAutoGrowHeight = false;
1085 }
1086 else
1087 {
1088 bAutoGrowWidth = false;
1089
1090 // #119885# re-activating bFitShapeToText here, could not find deeper explanations
1091 // for it (it was from 2005). Keeping the old comment here for reference
1092 // old comment: // bFitShapeToText; can't be used, because we cut the text if it is too height,
1093 bAutoGrowHeight = bFitShapeToText;
1094 }
1095 }
1096 pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? SvxFrameDirection::Vertical_RL_TB : SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
1097
1098 //Autofit text only if there is no auto grow height and width
1099 //See fdo#41245
1100 if (bAutoFit && !bAutoGrowHeight && !bAutoGrowWidth)
1101 {
1102 pTObj->SetMergedItem( SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_AUTOFIT) );
1103 }
1104
1105 if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
1106 {
1107 pTObj->SetMergedItem( makeSdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
1108 pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bAutoGrowHeight ) );
1109 }
1110 else
1111 {
1112 pTObj->SetMergedItem( makeSdrTextWordWrapItem( bWordWrap ) );
1113 pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bFitShapeToText ) );
1114 }
1115
1116 pTObj->SetMergedItem( SdrTextVertAdjustItem( eTVA ) );
1117 pTObj->SetMergedItem( SdrTextHorzAdjustItem( eTHA ) );
1118
1119 if ( nMinFrameHeight < 0 )
1120 nMinFrameHeight = 0;
1121 if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
1122 pTObj->SetMergedItem( makeSdrTextMinFrameHeightItem( nMinFrameHeight ) );
1123
1124 if ( nMinFrameWidth < 0 )
1125 nMinFrameWidth = 0;
1126 if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
1127 pTObj->SetMergedItem( makeSdrTextMinFrameWidthItem( nMinFrameWidth ) );
1128
1129 // set margins at the borders of the textbox
1130 pTObj->SetMergedItem( makeSdrTextLeftDistItem( nTextLeft ) );
1131 pTObj->SetMergedItem( makeSdrTextRightDistItem( nTextRight ) );
1132 pTObj->SetMergedItem( makeSdrTextUpperDistItem( nTextTop ) );
1133 pTObj->SetMergedItem( makeSdrTextLowerDistItem( nTextBottom ) );
1134 pTObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
1135
1136 if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
1137 pTObj->SetSnapRect( rTextRect );
1138 pTObj = ReadObjText( &aTextObj, pTObj.get(), rData.pPage );
1139
1140 if ( pTObj )
1141 {
1142 /* check if our new snaprect makes trouble,
1143 because we do not display the ADJUST_BLOCK
1144 properly if the textsize is bigger than the
1145 snaprect of the object. Then we will use
1146 ADJUST_CENTER instead of ADJUST_BLOCK.
1147 */
1148 if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr && !bFitShapeToText && !bWordWrap )
1149 {
1150 SdrTextObj* pText = DynCastSdrTextObj( pTObj.get() );
1151 if ( pText )
1152 {
1153 if ( bVerticalText )
1154 {
1155 if ( eTVA == SDRTEXTVERTADJUST_BLOCK )
1156 {
1157 Size aTextSize( pText->GetTextSize() );
1158 aTextSize.AdjustWidth(nTextLeft + nTextRight );
1159 aTextSize.AdjustHeight(nTextTop + nTextBottom );
1160 if ( rTextRect.GetHeight() < aTextSize.Height() )
1161 pTObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
1162 }
1163 }
1164 else
1165 {
1166 if ( eTHA == SDRTEXTHORZADJUST_BLOCK )
1167 {
1168 Size aTextSize( pText->GetTextSize() );
1169 aTextSize.AdjustWidth(nTextLeft + nTextRight );
1170 aTextSize.AdjustHeight(nTextTop + nTextBottom );
1171 if ( rTextRect.GetWidth() < aTextSize.Width() )
1172 pTObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_CENTER ) );
1173 }
1174 }
1175 }
1176 }
1177 // rotate text with shape?
1178 Degree100 nAngle = ( rObjData.nSpFlags & ShapeFlag::FlipV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way
1179 nAngle += nTextRotationAngle;
1180
1181 if ( dynamic_cast< const SdrObjCustomShape* >(pTObj.get()) == nullptr )
1182 {
1183 if ( rObjData.nSpFlags & ShapeFlag::FlipV )
1184 {
1185 pTObj->Rotate( rTextRect.Center(), 18000_deg100, 0.0, -1.0 );
1186 }
1187 if ( rObjData.nSpFlags & ShapeFlag::FlipH )
1188 nAngle = 36000_deg100 - nAngle;
1189 if ( nAngle )
1190 pTObj->NbcRotate( rObjData.aBoundRect.Center(), nAngle );
1191 }
1192 if ( pRet )
1193 {
1195 pGroup->GetSubList()->NbcInsertObject( pRet.get() );
1196 pGroup->GetSubList()->NbcInsertObject( pTObj.get() );
1197 pRet = pGroup;
1198 }
1199 else
1200 pRet = pTObj.get();
1201 }
1202 }
1203 }
1204 }
1205 else
1206 {
1208 {
1210 DffPropertyReader aSecPropSet( *this );
1211 aSecPropSet.ReadPropSet( rSt, &rClientData );
1212 sal_Int32 nTableProperties = aSecPropSet.GetPropertyValue( DFF_Prop_tableProperties, 0 );
1213 if ( nTableProperties & 3 )
1214 {
1215 if ( aSecPropSet.SeekToContent( DFF_Prop_tableRowProperties, rSt ) )
1216 {
1217 sal_Int16 i, nReadRowCount = 0;
1218 rSt.ReadInt16( nReadRowCount ).ReadInt16( i ).ReadInt16( i );
1219 if (nReadRowCount > 0)
1220 {
1221 const size_t nMinRecordSize = 4;
1222 const size_t nMaxRecords = rSt.remainingSize() / nMinRecordSize;
1223
1224 auto nRowCount = o3tl::make_unsigned(nReadRowCount);
1225 if (nRowCount > nMaxRecords)
1226 {
1227 SAL_WARN("filter.ms", "Parsing error: " << nMaxRecords <<
1228 " max possible entries, but " << nRowCount << " claimed, truncating");
1229 nRowCount = nMaxRecords;
1230 }
1231 if (nRowCount > 0)
1232 {
1233 std::unique_ptr<sal_uInt32[]> pTableArry(new sal_uInt32[ nRowCount + 2 ]);
1234 pTableArry[ 0 ] = nTableProperties;
1235 pTableArry[ 1 ] = nRowCount;
1236 for (decltype(nRowCount) nRow = 0; nRow < nRowCount; ++nRow)
1237 rSt.ReadUInt32(pTableArry[nRow + 2]);
1238 rData.pTableRowProperties = std::move(pTableArry);
1239 }
1240 }
1241 }
1242 }
1243 }
1244 }
1245 if ( pRet ) // sj: #i38501#, and taking care of connections to group objects
1246 {
1247 if ( rObjData.nSpFlags & ShapeFlag::Background )
1248 {
1249 pRet->NbcSetSnapRect( tools::Rectangle( Point(), rData.pPage.page->GetSize() ) ); // set size
1250 }
1251 if (rPersistEntry.xSolverContainer)
1252 {
1253 for (auto & pPtr : rPersistEntry.xSolverContainer->aCList)
1254 {
1255 if ( rObjData.nShapeId == pPtr->nShapeC )
1256 pPtr->pCObj = pRet.get();
1257 else
1258 {
1259 SdrObject* pConnectObj = pRet.get();
1260 if ( pOriginalObj && dynamic_cast< const SdrObjGroup* >(pRet.get()) != nullptr )
1261 { /* check if the original object from the escherimport is part of the group object,
1262 if this is the case, we will use the original object to connect to */
1263 SdrObjListIter aIter( *pRet, SdrIterMode::DeepWithGroups );
1264 while( aIter.IsMore() )
1265 {
1266 SdrObject* pPartObj = aIter.Next();
1267 if ( pPartObj == pOriginalObj )
1268 {
1269 pConnectObj = pPartObj;
1270 break;
1271 }
1272 }
1273 }
1274 if ( rObjData.nShapeId == pPtr->nShapeA )
1275 {
1276 pPtr->pAObj = pConnectObj;
1277 pPtr->nSpFlagsA = rObjData.nSpFlags;
1278 }
1279 if ( rObjData.nShapeId == pPtr->nShapeB )
1280 {
1281 pPtr->pBObj = pConnectObj;
1282 pPtr->nSpFlagsB = rObjData.nSpFlags;
1283 }
1284 }
1285 }
1286 }
1287 if ( rPersistEntry.ePageKind == PPT_MASTERPAGE )
1288 { // maybe the escher clusterlist is not correct, but we have to got the right page by using the
1289 // spMaster property, so we are patching the table
1290 if ( rPersistEntry.nDrawingDgId != 0xffffffff )
1291 {
1292 sal_uInt32 nSec = ( rObjData.nShapeId >> 10 ) - 1;
1293 if ( !maFidcls.empty() && ( nSec < mnIdClusters ) )
1294 maFidcls[ nSec ].dgid = rPersistEntry.nDrawingDgId; // insert the correct drawing id;
1295 }
1296 }
1297 if ( GetPropertyValue( DFF_Prop_fNoFillHitTest, 0 ) & 0x10 )
1298 {
1300 {
1301 rData.aBackgroundColoredObjects.push_back( pRet );
1302 }
1303 }
1304 }
1305 return pRet;
1306}
1307
1309 SdrEscherImport ( rParam, rBaseURL ),
1310 m_bOk ( rStCtrl.GetErrorCode() == ERRCODE_NONE ),
1311 m_nPersistPtrCnt ( 0 ),
1312 m_pDefaultSheet ( nullptr ),
1313 m_nCurrentPageNum ( 0 ),
1314 m_nDocStreamPos ( 0 ),
1315 m_nPageColorsNum ( 0xFFFF ),
1316 m_ePageColorsKind ( PPT_MASTERPAGE ),
1317 m_eCurrentPageKind ( PPT_MASTERPAGE )
1318{
1319 if ( m_bOk )
1320 {
1322
1323 // try to allocate the UserEditAtom via CurrentUserAtom
1324 sal_uInt32 nCurrentUserEdit = rParam.aCurrentUserAtom.nCurrentUserEdit;
1325 if (nCurrentUserEdit && checkSeek(rStCtrl, nCurrentUserEdit))
1326 {
1328 }
1330 { // if there is no UserEditAtom try to search the last one
1331
1332 rStCtrl.Seek( 0 );
1333 DffRecordManager aPptRecManager; // contains all first level container and atoms
1334 aPptRecManager.Consume( rStCtrl, nStreamLen );
1335 DffRecordHeader* pHd;
1336 for ( pHd = aPptRecManager.Last(); pHd; pHd = aPptRecManager.Prev() )
1337 {
1338 if ( pHd->nRecType == PPT_PST_UserEditAtom )
1339 {
1340 pHd->SeekToBegOfRecord( rStCtrl );
1342 break;
1343 }
1344 }
1345 if ( !pHd )
1346 m_bOk = false;
1347 }
1348 }
1349 if ( rStCtrl.GetError() != ERRCODE_NONE )
1350 m_bOk = false;
1351
1352 if ( m_bOk )
1353 {
1355 if ( ( m_nPersistPtrCnt >> 2 ) > nStreamLen ) // sj: at least m_nPersistPtrCnt is not allowed to be greater than filesize
1356 m_bOk = false; // (it should not be greater than the PPT_PST_PersistPtrIncrementalBlock, but
1357 // we are reading this block later, so we do not have access yet)
1358
1359 if ( m_bOk && ( m_nPersistPtrCnt < ( SAL_MAX_UINT32 / sizeof( sal_uInt32 ) ) -1 ) )
1360 m_pPersistPtr.reset( new (std::nothrow) sal_uInt32[ m_nPersistPtrCnt + 1 ] );
1361 if ( !m_pPersistPtr )
1362 m_bOk = false;
1363 if ( m_bOk )
1364 {
1365 memset( m_pPersistPtr.get(), 0x00, (m_nPersistPtrCnt+1) * sizeof(sal_uInt32) );
1366
1367 // SJ: new search mechanism from bottom to top (Issue 21122)
1368 PptUserEditAtom aCurrentEditAtom( m_aUserEditAtom );
1369 sal_uInt32 nCurrentEditAtomStrmPos = aCurrentEditAtom.aHd.GetRecEndFilePos();
1370 while( nCurrentEditAtomStrmPos )
1371 {
1372 sal_uInt32 nPersistIncPos = aCurrentEditAtom.nOffsetPersistDirectory;
1373 if (nPersistIncPos && checkSeek(rStCtrl, nPersistIncPos))
1374 {
1375 DffRecordHeader aPersistHd;
1376 ReadDffRecordHeader( rStCtrl, aPersistHd );
1377 if ( aPersistHd.nRecType == PPT_PST_PersistPtrIncrementalBlock )
1378 {
1379 sal_uLong nPibLen = aPersistHd.GetRecEndFilePos();
1380 while (m_bOk && rStCtrl.good() && (rStCtrl.Tell() < nPibLen))
1381 {
1382 sal_uInt32 nOfs(0);
1383 rStCtrl.ReadUInt32( nOfs );
1384 sal_uInt32 nCnt = nOfs;
1385 nOfs &= 0x000FFFFF;
1386 nCnt >>= 20;
1387 while (m_bOk && rStCtrl.good() && (nCnt > 0) && (nOfs <= m_nPersistPtrCnt))
1388 {
1389 sal_uInt32 nPt(0);
1390 rStCtrl.ReadUInt32( nPt );
1391 if ( !m_pPersistPtr[ nOfs ] )
1392 {
1393 m_pPersistPtr[ nOfs ] = nPt;
1394 if ( m_pPersistPtr[ nOfs ] > nStreamLen )
1395 {
1396 m_bOk = false;
1397 OSL_FAIL("SdrPowerPointImport::Ctor(): Invalid Entry in Persist-Directory!");
1398 }
1399 }
1400 nCnt--;
1401 nOfs++;
1402 }
1403 if ( m_bOk && nCnt > 0 )
1404 {
1405 OSL_FAIL("SdrPowerPointImport::Ctor(): Not all entries of Persist-Directory read!");
1406 m_bOk = false;
1407 }
1408 }
1409 }
1410 }
1411 nCurrentEditAtomStrmPos = aCurrentEditAtom.nOffsetLastEdit < nCurrentEditAtomStrmPos ? aCurrentEditAtom.nOffsetLastEdit : 0;
1412 if (nCurrentEditAtomStrmPos && checkSeek(rStCtrl, nCurrentEditAtomStrmPos))
1413 {
1414 ReadPptUserEditAtom( rStCtrl, aCurrentEditAtom );
1415 }
1416 }
1417 }
1418 }
1419 if ( rStCtrl.GetError() != ERRCODE_NONE )
1420 m_bOk = false;
1421 if ( m_bOk )
1422 { // check Document PersistEntry
1425 {
1426 OSL_FAIL("SdrPowerPointImport::Ctor(): m_aUserEditAtom.nDocumentRef invalid!");
1427 m_bOk = false;
1428 }
1429 }
1430 if ( m_bOk )
1431 { // check Document FilePos
1433 if ( m_nDocStreamPos >= nStreamLen )
1434 {
1435 OSL_FAIL("SdrPowerPointImport::Ctor(): m_nDocStreamPos >= nStreamLen!");
1436 m_bOk = false;
1437 }
1438 }
1439 if ( m_bOk )
1440 {
1443
1444 DffRecordHeader aDocHd;
1445 ReadDffRecordHeader( rStCtrl, aDocHd );
1446 // read DocumentAtom
1447 DffRecordHeader aDocAtomHd;
1448 ReadDffRecordHeader( rStCtrl, aDocAtomHd );
1449 if ( aDocHd.nRecType == PPT_PST_Document && aDocAtomHd.nRecType == PPT_PST_DocumentAtom )
1450 {
1451 aDocAtomHd.SeekToBegOfRecord( rStCtrl );
1453 }
1454 else
1455 m_bOk = false;
1456
1457 if ( m_bOk )
1458 {
1459 if (!m_xFonts)
1461
1462 // reading TxPF, TxSI
1464 PPTTextSpecInfoAtomInterpreter aTxSIStyle; // styles (default language setting ... )
1465
1467 if ( pEnvHd )
1468 {
1469 pEnvHd->SeekToContent( rStCtrl );
1470 DffRecordHeader aTxPFStyleRecHd;
1471 if ( SeekToRec( rStCtrl, PPT_PST_TxPFStyleAtom, pEnvHd->GetRecEndFilePos(), &aTxPFStyleRecHd ) )
1472 aTxPFStyle.Read( rStCtrl, aTxPFStyleRecHd );
1473
1474 pEnvHd->SeekToContent( rStCtrl );
1475 DffRecordHeader aTxSIStyleRecHd;
1476 if ( SeekToRec( rStCtrl, PPT_PST_TxSIStyleAtom, pEnvHd->GetRecEndFilePos(), &aTxSIStyleRecHd ) )
1477 {
1478 aTxSIStyle.Read( rStCtrl, aTxSIStyleRecHd, PPT_PST_TxSIStyleAtom );
1479#ifdef DBG_UTIL
1480 if ( !aTxSIStyle.bValid )
1481 {
1483 {
1484 OSL_FAIL( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" );
1485 }
1486 }
1487#endif
1488 }
1489 }
1490
1491 // TODO:: PPT_PST_TxPFStyleAtom
1492
1493 // read SlidePersists
1496 m_pNotePages.reset( new PptSlidePersistList );
1497
1498 // now always creating the handout page, it will be the first in our masterpage list
1499 std::unique_ptr<PptSlidePersistEntry> pE(new PptSlidePersistEntry);
1500 pE->aPersistAtom.nPsrReference = aDocAtom.nHandoutMasterPersist;
1501 pE->bHandoutMaster = true;
1503 pE->bStarDrawFiller = true; // this is a dummy master page
1504 m_pMasterPages->insert(m_pMasterPages->begin(), std::move(pE));
1505
1507 PptSlidePersistEntry* pPreviousPersist = nullptr;
1509 sal_uLong nPSTList = 0;
1510 if (pSlideListHd) nPSTList = pSlideListHd->GetRecBegFilePos();
1511 sal_uInt16 nRealPageNum = 0;
1512 // Normal PPT document has order of Master slides - Presentation slides - Note slides
1513 // for document with the order of Master slides - Note slides - Presentation slides
1514 // we need to swap the later two sections
1515 bool notePresentationSwap = false;
1516 for (sal_uInt16 nPageListNum = 0;
1517 pSlideListWithTextHd && nPageListNum < 3; ++nPageListNum)
1518 {
1519 pSlideListWithTextHd->SeekToContent( rStCtrl );
1520 PptSlidePersistList* pPageList = nullptr;
1521 sal_uInt32 nSlideListWithTextHdEndOffset = pSlideListWithTextHd->GetRecEndFilePos();
1522 nRealPageNum = nPageListNum;
1523 while ( SeekToRec( rStCtrl, PPT_PST_SlidePersistAtom, nSlideListWithTextHdEndOffset ) )
1524 {
1525 if ( pPreviousPersist )
1526 pPreviousPersist->nSlidePersistEndOffset = rStCtrl.Tell();
1527 std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
1528 ReadPptSlidePersistAtom( rStCtrl, pE2->aPersistAtom );
1529 pE2->nSlidePersistStartOffset = rStCtrl.Tell();
1530 // Note/Presentation section swap
1531 if (nPageListNum == 1 && pE2->nSlidePersistStartOffset < nPSTList)
1532 {
1533 notePresentationSwap = true;
1534 }
1535 if (notePresentationSwap)
1536 {
1537 if (nPageListNum == 1) nRealPageNum = 2;
1538 else if (nPageListNum == 2) nRealPageNum = 1;
1539 }
1540
1541 pE2->ePageKind = PptPageKind(nRealPageNum);
1542 pPreviousPersist = pE2.get();
1543 if (!pPageList)
1544 {
1545 pPageList = GetPageList(PptPageKind(nRealPageNum));
1546 }
1547 pPageList->push_back(std::move(pE2));
1548 }
1549 if ( pPreviousPersist )
1550 pPreviousPersist->nSlidePersistEndOffset = nSlideListWithTextHdEndOffset;
1552 }
1553
1554 // we will ensure that there is at least one master page
1555 if (m_pMasterPages->size() == 1) // -> there is only a handout page available
1556 {
1557 std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
1558 pE2->bStarDrawFiller = true; // this is a dummy master page
1559 m_pMasterPages->insert(m_pMasterPages->begin() + 1, std::move(pE2));
1560 }
1561
1562 // now we will insert at least one notes master for each master page
1563 sal_uInt16 nMasterPage;
1564 sal_uInt16 nMasterPages = m_pMasterPages->size() - 1;
1565 for ( nMasterPage = 0; nMasterPage < nMasterPages; nMasterPage++ )
1566 {
1567 std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
1568 pE2->bNotesMaster = true;
1569 pE2->bStarDrawFiller = true; // this is a dummy master page
1570 if ( !nMasterPage && aDocAtom.nNotesMasterPersist )
1571 { // special treatment for the first notes master
1572 pE2->aPersistAtom.nPsrReference = aDocAtom.nNotesMasterPersist;
1573 pE2->bStarDrawFiller = false; // this is a dummy master page
1574 }
1575 m_pMasterPages->insert(m_pMasterPages->begin() + ((nMasterPage + 1) << 1), std::move(pE2));
1576 }
1577
1578 // read for each page the SlideAtom respectively the NotesAtom if it exists
1579 for (sal_uInt16 nPageListNum = 0; nPageListNum < 3; ++nPageListNum)
1580 {
1581 PptSlidePersistList* pPageList = GetPageList( PptPageKind( nPageListNum ) );
1582 for ( size_t nPageNum = 0; nPageNum < pPageList->size(); nPageNum++ )
1583 {
1584 PptSlidePersistEntry& rE2 = (*pPageList)[ nPageNum ];
1585 sal_uLong nPersist = rE2.aPersistAtom.nPsrReference;
1586 if ( ( nPersist > 0 ) && ( nPersist < m_nPersistPtrCnt ) )
1587 {
1588 sal_uLong nFPos = m_pPersistPtr[ nPersist ];
1589 if ( nFPos < nStreamLen )
1590 {
1591 rStCtrl.Seek( nFPos );
1592 DffRecordHeader aSlideHd;
1593 ReadDffRecordHeader( rStCtrl, aSlideHd );
1596 else if ( SeekToRec( rStCtrl, PPT_PST_NotesAtom, aSlideHd.GetRecEndFilePos() ) )
1598 aSlideHd.SeekToContent( rStCtrl );
1599
1600 DffRecordHeader aPPTDrawingHd;
1601 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, aSlideHd.GetRecEndFilePos(), &aPPTDrawingHd ) )
1602 {
1603 DffRecordHeader aPPTDgContainer;
1604 if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, aPPTDrawingHd.GetRecEndFilePos(), &aPPTDgContainer ) )
1605 {
1606 if ( SeekToRec( rStCtrl, DFF_msofbtDg, aPPTDrawingHd.GetRecEndFilePos() ) )
1607 {
1608 DffRecordHeader aDgRecordHeader;
1609 ReadDffRecordHeader( rStCtrl, aDgRecordHeader );
1610 rE2.nDrawingDgId = aDgRecordHeader.nRecInstance;
1611 aDgRecordHeader.SeekToEndOfRecord( rStCtrl );
1612 }
1613 if ( SeekToRec( rStCtrl, DFF_msofbtSolverContainer, aPPTDgContainer.GetRecEndFilePos() ) )
1614 {
1617 }
1618 aPPTDgContainer.SeekToBegOfRecord( rStCtrl );
1619 SetDgContainer( rStCtrl ); // set this, so that the escherimport is knowing of our drawings
1620 }
1621 }
1622 // office xp is supporting more than one stylesheet
1623 if ( ( rE2.ePageKind == PPT_MASTERPAGE ) && ( rE2.aSlideAtom.nMasterId == 0 ) && !rE2.bNotesMaster )
1624 {
1625 PPTTextSpecInfo aTxSI( 0 );
1626 if ( aTxSIStyle.bValid && !aTxSIStyle.aList.empty() )
1627 aTxSI = aTxSIStyle.aList[ 0 ];
1628
1629 rE2.xStyleSheet = std::make_unique<PPTStyleSheet>(aSlideHd, rStCtrl, *this, aTxPFStyle, aTxSI);
1630 m_pDefaultSheet = rE2.xStyleSheet.get();
1631 }
1634 else
1635 {
1636 OSL_FAIL( "SdrPowerPointImport::Ctor(): could not get SlideColorScheme! (SJ)" );
1637 }
1638 }
1639 else
1640 {
1641 OSL_FAIL("SdrPowerPointImport::Ctor(): Persist entry is flawed! (SJ)");
1642 }
1643 }
1644 }
1645 }
1647 if ( pHeadersFootersHd )
1648 {
1649 HeaderFooterEntry aNormalMaster, aNotesMaster;
1650 for ( ; pHeadersFootersHd; pHeadersFootersHd = aDocRecManager.GetRecordHeader( PPT_PST_HeadersFooters, SEEK_FROM_CURRENT ) )
1651 {
1652 if ( pHeadersFootersHd->nRecInstance == 3 ) // normal master
1653 ImportHeaderFooterContainer( *pHeadersFootersHd, aNormalMaster );
1654 else if ( pHeadersFootersHd->nRecInstance == 4 ) // notes master
1655 ImportHeaderFooterContainer( *pHeadersFootersHd, aNotesMaster );
1656 }
1657 for (size_t i = 0; i < m_pMasterPages->size(); i++)
1658 {
1659 if ((*m_pMasterPages)[ i ].bNotesMaster)
1660 (*m_pMasterPages)[ i ].xHeaderFooterEntry.reset(new HeaderFooterEntry(aNotesMaster));
1661 else
1662 (*m_pMasterPages)[ i ].xHeaderFooterEntry.reset(new HeaderFooterEntry(aNormalMaster));
1663 }
1664 }
1665 }
1666 }
1667 if ( ( rStCtrl.GetError() != ERRCODE_NONE ) || ( m_pDefaultSheet == nullptr ) )
1668 m_bOk = false;
1670 rStCtrl.Seek( 0 );
1671}
1672
1674{
1675 m_pMasterPages.reset();
1676 m_pSlidePages.reset();
1677 m_pNotePages.reset();
1678}
1679
1681 css::uno::Reference< css::drawing::XShape > *pShapeRef )
1682{
1683 bool bRes = false;
1684 uno::Reference< form::XFormComponent > xFComp;
1685 if ( mpPPTImporter && mpPPTImporter->ReadFormControl( rSrc, xFComp ) )
1686 {
1687 if ( xFComp.is() )
1688 {
1689 css::awt::Size aSz; // not used in import
1690 bRes = InsertControl( xFComp, aSz,pShapeRef, false/*bFloatingCtrl*/);
1691 }
1692 }
1693 return bRes;
1694}
1695
1697 const css::uno::Reference< css::form::XFormComponent > &rFComp,
1698 const css::awt::Size& rSize,
1699 css::uno::Reference< css::drawing::XShape > *pShape,
1700 bool /*bFloatingCtrl*/)
1701{
1702 bool bRetValue = false;
1703 try
1704 {
1705 css::uno::Reference< css::drawing::XShape > xShape;
1706
1707 const css::uno::Reference< css::container::XIndexContainer > & rFormComps =
1708 GetFormComps();
1709
1710 css::uno::Any aTmp( &rFComp, cppu::UnoType<css::form::XFormComponent>::get() );
1711
1712 rFormComps->insertByIndex( rFormComps->getCount(), aTmp );
1713
1714 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceFactory =
1716 if( rServiceFactory.is() )
1717 {
1718 css::uno::Reference< css::uno::XInterface > xCreate = rServiceFactory
1719 ->createInstance( "com.sun.star.drawing.ControlShape" );
1720 if( xCreate.is() )
1721 {
1722 xShape.set(xCreate, css::uno::UNO_QUERY);
1723 if ( xShape.is() )
1724 {
1725 xShape->setSize(rSize);
1726 // set the Control-Model at the Control-Shape
1727 css::uno::Reference< css::drawing::XControlShape > xControlShape( xShape,
1728 css::uno::UNO_QUERY );
1729 css::uno::Reference< css::awt::XControlModel > xControlModel( rFComp,
1730 css::uno::UNO_QUERY );
1731 if ( xControlShape.is() && xControlModel.is() )
1732 {
1733 xControlShape->setControl( xControlModel );
1734 if (pShape)
1735 *pShape = xShape;
1736 bRetValue = true;
1737 }
1738 }
1739 }
1740 }
1741 }
1742 catch( ... )
1743 {
1744 bRetValue = false;
1745 }
1746 return bRetValue;
1747};
1749{
1750 if( xDrawPage.is() || !mxModel.is() )
1751 return;
1752
1753 css::uno::Reference< css::drawing::XDrawPages > xDrawPages;
1754 switch( ePageKind )
1755 {
1756 case PPT_SLIDEPAGE :
1757 case PPT_NOTEPAGE :
1758 {
1759 css::uno::Reference< css::drawing::XDrawPagesSupplier >
1760 xDrawPagesSupplier( mxModel, css::uno::UNO_QUERY);
1761 if ( xDrawPagesSupplier.is() )
1762 xDrawPages = xDrawPagesSupplier->getDrawPages();
1763 }
1764 break;
1765
1766 case PPT_MASTERPAGE :
1767 {
1768 css::uno::Reference< css::drawing::XMasterPagesSupplier >
1769 xMasterPagesSupplier( mxModel, css::uno::UNO_QUERY);
1770 if ( xMasterPagesSupplier.is() )
1771 xDrawPages = xMasterPagesSupplier->getMasterPages();
1772 }
1773 break;
1774 }
1775 if ( xDrawPages.is() && xDrawPages->getCount() )
1776 {
1777 xDrawPages->getCount();
1778 css::uno::Any aAny( xDrawPages->getByIndex( xDrawPages->getCount() - 1 ) );
1779 aAny >>= xDrawPage;
1780 }
1781}
1782
1783static bool SdrPowerPointOLEDecompress( SvStream& rOutput, SvStream& rInput, sal_uInt32 nInputSize )
1784{
1785 sal_uInt32 nOldPos = rInput.Tell();
1786 std::unique_ptr<char[]> pBuf(new char[ nInputSize ]);
1787 rInput.ReadBytes(pBuf.get(), nInputSize);
1788 ZCodec aZCodec( 0x8000, 0x8000 );
1789 aZCodec.BeginCompression();
1790 SvMemoryStream aSource( pBuf.get(), nInputSize, StreamMode::READ );
1791 aZCodec.Decompress( aSource, rOutput );
1792 const bool bSuccess(0 != aZCodec.EndCompression());
1793 rInput.Seek( nOldPos );
1794 return bSuccess;
1795}
1796
1797// #i32596# - add new parameter <_nCalledByGroup>
1799 const Graphic& rGraf,
1800 const tools::Rectangle& rBoundRect,
1801 const tools::Rectangle& rVisArea,
1802 const int /*_nCalledByGroup*/ ) const
1803{
1805
1806 sal_uInt32 nOldPos = rStCtrl.Tell();
1807
1808 Graphic aGraphic( rGraf );
1809
1811 {
1812 DffRecordHeader aPlaceHd;
1813
1814 auto nEndRecPos = SanitizeEndPos(rStCtrl, const_cast<SdrPowerPointImport*>(this)->maShapeRecords.Current()->GetRecEndFilePos());
1815 while ( ( rStCtrl.GetError() == ERRCODE_NONE )
1816 && ( rStCtrl.Tell() < nEndRecPos ) )
1817 {
1818 ReadDffRecordHeader( rStCtrl, aPlaceHd );
1819 if ( aPlaceHd.nRecType == PPT_PST_RecolorInfoAtom )
1820 {
1821 const_cast<SdrPowerPointImport*>(this)->RecolorGraphic( rStCtrl, aPlaceHd.nRecLen, aGraphic );
1822 break;
1823 }
1824 else
1825 {
1826 if (!aPlaceHd.SeekToEndOfRecord(rStCtrl))
1827 break;
1828 }
1829 }
1830 }
1831
1832 for (PPTOleEntry& rOe : const_cast<SdrPowerPointImport*>(this)->aOleObjectList)
1833 {
1834 if ( rOe.nId != nOLEId )
1835 continue;
1836
1837 rStCtrl.Seek( rOe.nRecHdOfs );
1838
1839 DffRecordHeader aHd;
1841
1842 sal_uInt32 nLen = aHd.nRecLen - 4;
1843 if ( static_cast<sal_Int32>(nLen) > 0 )
1844 {
1845 bool bSuccess = false;
1846
1847 rStCtrl.SeekRel( 4 );
1848
1849 ::utl::TempFileFast aTmpFile;
1850 SvStream* pDest = aTmpFile.GetStream(StreamMode::READWRITE);
1851 if (pDest)
1852 {
1853 bSuccess = SdrPowerPointOLEDecompress( *pDest, rStCtrl, nLen );
1854 }
1855 if ( bSuccess )
1856 {
1857 pDest->Seek(0);
1858 Storage* pObjStor = new Storage(*pDest, false);
1859 tools::SvRef<SotStorage> xObjStor( new SotStorage( pObjStor ) );
1860 if ( xObjStor.is() && !xObjStor->GetError() )
1861 {
1862 if ( xObjStor->GetClassName() == SvGlobalName() )
1863 {
1864 xObjStor->SetClass( SvGlobalName( pObjStor->GetClassId() ), pObjStor->GetFormat(), pObjStor->GetUserName() );
1865 }
1866 tools::SvRef<SotStorageStream> xSrcTst = xObjStor->OpenSotStream( "\1Ole" );
1867 if ( xSrcTst.is() )
1868 {
1869 sal_uInt8 aTestA[ 10 ];
1870 bool bGetItAsOle = (sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
1871 if ( !bGetItAsOle )
1872 { // maybe there is a contents stream in here
1873 xSrcTst = xObjStor->OpenSotStream( "Contents", StreamMode::READWRITE | StreamMode::NOCREATE );
1874 bGetItAsOle = (xSrcTst.is() &&
1875 sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
1876 }
1877 if ( bGetItAsOle )
1878 {
1879 OUString aNm;
1880 // if ( nSvxMSDffOLEConvFlags )
1881 {
1882 uno::Reference < embed::XStorage > xDestStorage( rOe.pShell->GetStorage() );
1883 uno::Reference < embed::XEmbeddedObject > xObj =
1884 CheckForConvertToSOObj(nSvxMSDffOLEConvFlags, *xObjStor, xDestStorage, rGraf, rVisArea, maBaseURL);
1885 if( xObj.is() )
1886 {
1887 rOe.pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
1888
1889 svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
1890
1891 // TODO/LATER: need MediaType for Graphic
1892 aObj.SetGraphic( rGraf, OUString() );
1893 pRet = new SdrOle2Obj(
1894 *pSdrModel,
1895 aObj,
1896 aNm,
1897 rBoundRect);
1898 }
1899 }
1900 if ( !pRet && ( rOe.nType == PPT_PST_ExControl ) )
1901 {
1902 uno::Reference< frame::XModel > xModel( rOe.pShell->GetModel() );
1903 PPTConvertOCXControls aPPTConvertOCXControls( this, xModel, m_eCurrentPageKind );
1904 css::uno::Reference< css::drawing::XShape > xShape;
1905 if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape ) )
1906 pRet = SdrObject::getSdrObjectFromXShape(xShape);
1907
1908 }
1909 if ( !pRet )
1910 {
1911 aNm = rOe.pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
1912
1913 // object is not an own object
1914 const css::uno::Reference < css::embed::XStorage >& rStorage = rOe.pShell->GetStorage();
1915 if (rStorage.is())
1916 {
1917 tools::SvRef<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE);
1918 if (xObjStor.is() && xTarget.is())
1919 {
1920 xObjStor->CopyTo(xTarget.get());
1921 if (!xTarget->GetError())
1922 xTarget->Commit();
1923 }
1924 xTarget.clear();
1925 }
1926
1927 uno::Reference < embed::XEmbeddedObject > xObj =
1928 rOe.pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
1929 if ( xObj.is() )
1930 {
1931 if ( rOe.nAspect != embed::Aspects::MSOLE_ICON )
1932 {
1933 //TODO/LATER: keep on hacking?!
1934 // we don't want to be modified
1935 //xInplaceObj->EnableSetModified( sal_False );
1936 if ( rVisArea.IsEmpty() )
1937 {
1938 MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rOe.nAspect ) );
1939 Size aSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
1940 aGraphic.GetPrefMapMode(), MapMode( aMapUnit ) ) );
1941
1942 awt::Size aSz;
1943 aSz.Width = aSize.Width();
1944 aSz.Height = aSize.Height();
1945 xObj->setVisualAreaSize( rOe.nAspect, aSz );
1946 }
1947 else
1948 {
1949 awt::Size aSize( rVisArea.GetSize().Width(), rVisArea.GetSize().Height() );
1950 xObj->setVisualAreaSize( rOe.nAspect, aSize );
1951 }
1952 //xInplaceObj->EnableSetModified( sal_True );
1953 }
1954
1955 svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
1956
1957 // TODO/LATER: need MediaType for Graphic
1958 aObj.SetGraphic( aGraphic, OUString() );
1959
1960 pRet = new SdrOle2Obj(
1961 *pSdrModel,
1962 aObj,
1963 aNm,
1964 rBoundRect);
1965 }
1966 }
1967 }
1968 }
1969 }
1970 }
1971 aTmpFile.CloseStream();
1972 }
1973 }
1974 rStCtrl.Seek( nOldPos );
1975
1976 return pRet;
1977}
1978
1979std::unique_ptr<SvMemoryStream> SdrPowerPointImport::ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const
1980{
1981 std::unique_ptr<SvMemoryStream> pRet;
1982 if ( nPersistPtr && ( nPersistPtr < m_nPersistPtrCnt ) )
1983 {
1984 sal_uInt32 nOldPos, nOfs = m_pPersistPtr[ nPersistPtr ];
1985 nOldPos = rStCtrl.Tell();
1986 rStCtrl.Seek( nOfs );
1987 DffRecordHeader aHd;
1989 if ( aHd.nRecType == DFF_PST_ExOleObjStg )
1990 {
1991 sal_uInt32 nLen = aHd.nRecLen - 4;
1992 if ( static_cast<sal_Int32>(nLen) > 0 )
1993 {
1994 rStCtrl.ReadUInt32( nOleId );
1995 pRet.reset(new SvMemoryStream);
1996 ZCodec aZCodec( 0x8000, 0x8000 );
1997 aZCodec.BeginCompression();
1998 aZCodec.Decompress( rStCtrl, *pRet );
1999 if ( !aZCodec.EndCompression() )
2000 {
2001 pRet.reset();
2002 }
2003 }
2004 }
2005 rStCtrl.Seek( nOldPos );
2006 }
2007 return pRet;
2008}
2009
2010void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions )
2011{
2012 if ( !pShell )
2013 return;
2014
2015 DffRecordHeader* pHd;
2016
2017 sal_uInt32 nOldPos = rStCtrl.Tell();
2018 if ( nFilterOptions & 1 )
2019 {
2021 if ( pHd )
2022 {
2023 // we try to locate the basic atom
2024 pHd->SeekToContent( rStCtrl );
2025 if ( SeekToRec( rStCtrl, PPT_PST_VBAInfo, pHd->GetRecEndFilePos(), pHd ) )
2026 {
2028 {
2029 sal_uInt32 nPersistPtr, nIDoNotKnow1, nIDoNotKnow2;
2030 rStCtrl.ReadUInt32( nPersistPtr )
2031 .ReadUInt32( nIDoNotKnow1 )
2032 .ReadUInt32( nIDoNotKnow2 );
2033
2034 sal_uInt32 nOleId;
2035 std::unique_ptr<SvMemoryStream> pBas = ImportExOleObjStg( nPersistPtr, nOleId );
2036 if ( pBas )
2037 {
2038 tools::SvRef<SotStorage> xSource( new SotStorage( pBas.release(), true ) );
2039 tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) );
2040 if ( xSource.is() && xDest.is() )
2041 {
2042 // is this a visual basic storage ?
2043 tools::SvRef<SotStorage> xSubStorage = xSource->OpenSotStorage( "VBA",
2044 StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL );
2045 if( xSubStorage.is() && ( ERRCODE_NONE == xSubStorage->GetError() ) )
2046 {
2047 tools::SvRef<SotStorage> xMacros = xDest->OpenSotStorage( "MACROS" );
2048 if ( xMacros.is() )
2049 {
2050 SvStorageInfoList aList;
2051 xSource->FillInfoList( &aList );
2052 SvStorageInfoList::size_type i;
2053
2054 bool bCopied = true;
2055 for ( i = 0; i < aList.size(); i++ ) // copy all entries
2056 {
2057 const SvStorageInfo& rInfo = aList[ i ];
2058 if ( !xSource->CopyTo( rInfo.GetName(), xMacros.get(), rInfo.GetName() ) )
2059 bCopied = false;
2060 }
2061 if ( i && bCopied )
2062 {
2063 uno::Reference < embed::XStorage > xDoc( pShell->GetStorage() );
2064 if ( xDoc.is() )
2065 {
2067 if ( xVBA.is() && ( xVBA->GetError() == ERRCODE_NONE ) )
2068 {
2069 tools::SvRef<SotStorage> xSubVBA = xVBA->OpenSotStorage( "_MS_VBA_Overhead" );
2070 if ( xSubVBA.is() && ( xSubVBA->GetError() == ERRCODE_NONE ) )
2071 {
2072 tools::SvRef<SotStorageStream> xOriginal = xSubVBA->OpenSotStream( "_MS_VBA_Overhead2" );
2073 if ( xOriginal.is() && ( xOriginal->GetError() == ERRCODE_NONE ) )
2074 {
2075 if ( nPersistPtr && ( nPersistPtr < m_nPersistPtrCnt ) )
2076 {
2077 rStCtrl.Seek( m_pPersistPtr[ nPersistPtr ] );
2079
2080 xOriginal->WriteUInt32( nIDoNotKnow1 )
2081 .WriteUInt32( nIDoNotKnow2 );
2082
2083 sal_uInt32 nToCopy, nBufSize;
2084 nToCopy = pHd->nRecLen;
2085 std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ 0x40000 ]); // 256KB Buffer
2086 while ( nToCopy )
2087 {
2088 nBufSize = ( nToCopy >= 0x40000 ) ? 0x40000 : nToCopy;
2089 rStCtrl.ReadBytes(pBuf.get(), nBufSize);
2090 xOriginal->WriteBytes(pBuf.get(), nBufSize);
2091 nToCopy -= nBufSize;
2092 }
2093 }
2094 }
2095 }
2096 }
2097 xVBA->Commit();
2098 }
2099 }
2100 }
2101 }
2102 }
2103 }
2104 }
2105 }
2106 }
2107 }
2109 if ( pHd )
2110 {
2111 DffRecordHeader* pExEmbed = nullptr;
2112
2113 pHd->SeekToBegOfRecord( rStCtrl );
2114 DffRecordManager aExObjListManager( rStCtrl );
2115 sal_uInt16 i, nRecType(PPT_PST_ExEmbed);
2116
2117 for ( i = 0; i < 2; i++ )
2118 {
2119 switch ( i )
2120 {
2121 case 0 : nRecType = PPT_PST_ExEmbed; break;
2122 case 1 : nRecType = PPT_PST_ExControl; break;
2123 }
2124 for ( pExEmbed = aExObjListManager.GetRecordHeader( nRecType );
2125 pExEmbed; pExEmbed = aExObjListManager.GetRecordHeader( nRecType, SEEK_FROM_CURRENT ) )
2126 {
2127 pExEmbed->SeekToContent( rStCtrl );
2128
2129 DffRecordHeader aExOleAtHd;
2130 if ( SeekToRec( rStCtrl, PPT_PST_ExOleObjAtom, pExEmbed->GetRecEndFilePos(), &aExOleAtHd ) )
2131 {
2132 PptExOleObjAtom aAt;
2134
2135 if ( aAt.nPersistPtr && ( aAt.nPersistPtr < m_nPersistPtrCnt ) )
2136 {
2138 DffRecordHeader aHd;
2140 if ( aHd.nRecType == DFF_PST_ExOleObjStg )
2141 {
2142 sal_uInt32 nId;
2144 aOleObjectList.emplace_back(
2145 aAt.nId, aHd.nFilePos, pShell, nRecType, aAt.nAspect );
2146 }
2147 }
2148 }
2149 }
2150 }
2151 }
2152 rStCtrl.Seek( nOldPos );
2153}
2154
2156{
2157 bool bRet = false;
2159 if ( pEnvHd )
2160 {
2161 sal_uInt64 nOldFPos = rStCtrl.Tell(); // remember FilePos for restoring it later
2162 pEnvHd->SeekToContent( rStCtrl );
2163 DffRecordHeader aListHd;
2164 if ( SeekToRec( rStCtrl, PPT_PST_FontCollection, pEnvHd->GetRecEndFilePos(), &aListHd ) )
2165 {
2166 sal_uInt16 nCount2 = 0;
2168 {
2169 bRet = true;
2170 if (!m_xFonts)
2171 m_xFonts.emplace();
2172 PptFontEntityAtom aFontAtom;
2173 ReadPptFontEntityAtom( rStCtrl, aFontAtom );
2174
2175 vcl::Font aFont;
2176 aFont.SetCharSet( aFontAtom.eCharSet );
2177 aFont.SetFamilyName( aFontAtom.aName );
2178 aFont.SetFamily( aFontAtom.eFamily );
2179 aFont.SetPitch( aFontAtom.ePitch );
2180 aFont.SetFontHeight( 100 );
2181
2182 // following block is necessary, because our old PowerPoint export did not set the
2183 // correct charset
2184 if ( aFontAtom.aName.equalsIgnoreAsciiCase( "Wingdings" ) ||
2185 aFontAtom.aName.equalsIgnoreAsciiCase( "Wingdings 2" ) ||
2186 aFontAtom.aName.equalsIgnoreAsciiCase( "Wingdings 3" ) ||
2187 aFontAtom.aName.equalsIgnoreAsciiCase( "Monotype Sorts" ) ||
2188 aFontAtom.aName.equalsIgnoreAsciiCase( "Monotype Sorts 2" ) ||
2189 aFontAtom.aName.equalsIgnoreAsciiCase( "Webdings" ) ||
2190 aFontAtom.aName.equalsIgnoreAsciiCase( "StarBats" ) ||
2191 aFontAtom.aName.equalsIgnoreAsciiCase( "StarMath" ) ||
2192 aFontAtom.aName.equalsIgnoreAsciiCase( "ZapfDingbats" ) )
2193 {
2194 aFontAtom.eCharSet = RTL_TEXTENCODING_SYMBOL;
2195 };
2196 m_xFonts->insert(m_xFonts->begin() + nCount2++, std::move(aFontAtom));
2197 }
2198 }
2199 rStCtrl.Seek( nOldFPos ); // restore FilePos
2200 }
2201 return bRet;
2202}
2203
2205{
2206 switch (ePageKind)
2207 {
2208 case PPT_MASTERPAGE:
2209 return m_pMasterPages.get();
2210 case PPT_SLIDEPAGE:
2211 return m_pSlidePages.get();
2212 case PPT_NOTEPAGE:
2213 return m_pNotePages.get();
2214 }
2215 return nullptr;
2216}
2217
2219{
2220 if ( !pSdrText )
2221 return nullptr;
2222 else
2223 return &pSdrText->ImpGetDrawOutliner();
2224}
2225
2226
2228{
2229 SdrTextObj* pText = DynCastSdrTextObj( pSdrObj );
2230 if ( pText )
2231 {
2232 if ( !ApplyTextObj( pTextObj, pText, pPage, nullptr, nullptr ) )
2233 pSdrObj = nullptr;
2234 }
2235 return pSdrObj;
2236}
2237
2239 SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
2240{
2241 SdrTextObj* pText = pSdrText;
2242 if ( pTextObj->Count() )
2243 {
2244 TSS_Type nDestinationInstance = pTextObj->GetDestinationInstance() ;
2245 SdrOutliner& rOutliner = pText->ImpGetDrawOutliner();
2246 bool bUndoEnabled = rOutliner.IsUndoEnabled();
2247 rOutliner.EnableUndo(false);
2248
2249 if ( ( pText->GetObjInventor() == SdrInventor::Default ) && ( pText->GetObjIdentifier() == SdrObjKind::TitleText ) ) // Outliner-Style for Title-Text object?!? (->of DL)
2250 rOutliner.Init( OutlinerMode::TitleObject ); // Outliner reset
2251
2252 bool bOldUpdateMode = rOutliner.SetUpdateLayout( false );
2253 if ( pSheet )
2254 {
2255 if ( rOutliner.GetStyleSheet( 0 ) != pSheet )
2256 rOutliner.SetStyleSheet( 0, pSheet );
2257 }
2258 rOutliner.SetVertical( pTextObj->GetVertical() );
2259 for ( PPTParagraphObj* pPara = pTextObj->First(); pPara; pPara = pTextObj->Next() )
2260 {
2261 sal_uInt32 nTextSize = pPara->GetTextSize();
2262 if ( ! ( nTextSize & 0xffff0000 ) )
2263 {
2264 PPTPortionObj* pPortion;
2265 std::unique_ptr<sal_Unicode[]> pParaText(new sal_Unicode[ nTextSize ]);
2266 sal_Int32 nCurrentIndex = 0;
2267 for ( pPortion = pPara->First(); pPortion; pPortion = pPara->Next() )
2268 {
2269 if ( pPortion->mpFieldItem )
2270 pParaText[ nCurrentIndex++ ] = ' ';
2271 else
2272 {
2273 sal_Int32 nCharacters = pPortion->Count();
2274 const sal_Unicode* pSource = pPortion->maString.getStr();
2275 sal_Unicode* pDest = pParaText.get() + nCurrentIndex;
2276
2277 sal_uInt32 nFont;
2278 pPortion->GetAttrib( PPT_CharAttr_Font, nFont, pTextObj->GetInstance() );
2279 const PptFontEntityAtom* pFontEnityAtom = GetFontEnityAtom( nFont );
2280 if ( pFontEnityAtom && ( pFontEnityAtom->eCharSet == RTL_TEXTENCODING_SYMBOL ) )
2281 {
2282 sal_Unicode nUnicode;
2283 for (sal_Int32 i = 0; i < nCharacters; i++ )
2284 {
2285 nUnicode = pSource[ i ];
2286 if ( ! ( nUnicode & 0xff00 ) )
2287 nUnicode |= 0xf000;
2288 pDest[ i ] = nUnicode;
2289 }
2290 }
2291 else
2292 memcpy( pDest, pSource, nCharacters << 1 );
2293 nCurrentIndex += nCharacters;
2294 }
2295 }
2296 sal_Int32 nParaIndex = pTextObj->GetCurrentIndex();
2297 SfxStyleSheet* pS = ppStyleSheetAry ? ppStyleSheetAry[ pPara->mxParaSet->mnDepth ] : pSheet;
2298
2299 ESelection aSelection( nParaIndex, 0, nParaIndex, 0 );
2300 rOutliner.Insert( OUString(), nParaIndex, pPara->mxParaSet->mnDepth );
2301 rOutliner.QuickInsertText( OUString(pParaText.get(), nCurrentIndex), aSelection );
2302 rOutliner.SetParaAttribs( nParaIndex, rOutliner.GetEmptyItemSet() );
2303 if ( pS )
2304 rOutliner.SetStyleSheet( nParaIndex, pS );
2305
2306 for ( pPortion = pPara->First(); pPortion; pPortion = pPara->Next() )
2307 {
2308 SfxItemSet aPortionAttribs( rOutliner.GetEmptyItemSet() );
2309 std::unique_ptr<SvxFieldItem> pFieldItem(pPortion->GetTextField());
2310 if ( pFieldItem )
2311 {
2312 rOutliner.QuickInsertField( *pFieldItem, ESelection( nParaIndex, aSelection.nEndPos, nParaIndex, aSelection.nEndPos + 1 ) );
2313 aSelection.nEndPos++;
2314 }
2315 else
2316 {
2317 const sal_Unicode *pF, *pPtr = pPortion->maString.getStr();
2318 const sal_Unicode *pMax = pPtr + pPortion->maString.getLength();
2319 sal_Int32 nLen;
2320 for ( pF = pPtr; pPtr < pMax; pPtr++ )
2321 {
2322 if ( *pPtr == 0xb )
2323 {
2324 nLen = pPtr - pF;
2325 if ( nLen )
2326 aSelection.nEndPos =
2327 sal::static_int_cast< sal_uInt16 >(
2328 aSelection.nEndPos + nLen );
2329 pF = pPtr + 1;
2330 rOutliner.QuickInsertLineBreak( ESelection( nParaIndex, aSelection.nEndPos, nParaIndex, aSelection.nEndPos + 1 ) );
2331 aSelection.nEndPos++;
2332 }
2333 }
2334 nLen = pPtr - pF;
2335 if ( nLen )
2336 aSelection.nEndPos = sal::static_int_cast< sal_uInt16 >(
2337 aSelection.nEndPos + nLen );
2338 }
2339 pPortion->ApplyTo( aPortionAttribs, const_cast<SdrPowerPointImport&>(*this), nDestinationInstance, pTextObj );
2340 rOutliner.QuickSetAttribs( aPortionAttribs, aSelection );
2341 aSelection.nStartPos = aSelection.nEndPos;
2342 }
2343 std::optional< sal_Int16 > oStartNumbering;
2344 SfxItemSet aParagraphAttribs( rOutliner.GetEmptyItemSet() );
2345 pPara->ApplyTo( aParagraphAttribs, oStartNumbering, *this, nDestinationInstance );
2346
2347 sal_uInt32 nIsBullet2 = 0; //, nInstance = nDestinationInstance != 0xffffffff ? nDestinationInstance : pTextObj->GetInstance();
2348 pPara->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance );
2349 if ( !nIsBullet2 )
2350 aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, false ) );
2351 else
2352 aParagraphAttribs.Put( SfxInt16Item(EE_PARA_OUTLLEVEL, pPara->mxParaSet->mnDepth));
2353
2354 if ( !aSelection.nStartPos ) // in PPT empty paragraphs never gets a bullet
2355 {
2356 aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, false ) );
2357 }
2358 aSelection.nStartPos = 0;
2359 rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection );
2360 }
2361 }
2362 std::optional<OutlinerParaObject> pNewText = rOutliner.CreateParaObject();
2363 rOutliner.Clear();
2364 rOutliner.SetUpdateLayout( bOldUpdateMode );
2365 rOutliner.EnableUndo(bUndoEnabled);
2366 pText->SetOutlinerParaObject( std::move(pNewText) );
2367 }
2368 return pText;
2369}
2370
2372{
2373 bool bRet;
2374 sal_uInt64 nOldFPos = rStCtrl.Tell(); // remember FilePos for restoring it, if the situation should happen
2376 DffRecordHeader aDocHd;
2377 ReadDffRecordHeader( rStCtrl, aDocHd );
2378 bRet = aDocHd.nRecType == PPT_PST_Document;
2379 if ( bRet )
2380 {
2381 if ( pRecHd )
2382 *pRecHd = aDocHd;
2383 else
2384 aDocHd.SeekToBegOfRecord( rStCtrl );
2385 }
2386 if ( !bRet )
2387 rStCtrl.Seek( nOldFPos ); // restore FilePos
2388 return bRet;
2389}
2390
2392 const DffRecordHeader& rSourceHd, DffRecordHeader& rContentHd )
2393{
2394 bool bRetValue = false;
2395 sal_uInt32 nOldPos = rSt.Tell();
2396
2397 DffRecordHeader aProgTagsHd, aProgTagBinaryDataHd;
2398 rSourceHd.SeekToContent( rSt );
2399 bool bFound = rSourceHd.nRecType == PPT_PST_ProgTags;
2400 if ( !bFound )
2401 bFound = SeekToRec( rSt, PPT_PST_ProgTags, rSourceHd.GetRecEndFilePos(), &aProgTagsHd );
2402 if ( bFound )
2403 {
2404 while( SeekToRec( rSt, PPT_PST_ProgBinaryTag, aProgTagsHd.GetRecEndFilePos(), &aProgTagBinaryDataHd ) )
2405 {
2406 ReadDffRecordHeader( rSt, rContentHd );
2407 if ( rContentHd.nRecType == PPT_PST_CString )
2408 {
2409 sal_uInt16 n = 6;
2410 sal_uInt32 i = rContentHd.nRecLen >> 1;
2411 if ( i > n )
2412 {
2413 OUString aPre = read_uInt16s_ToOUString(rSt, n);
2414 n = static_cast<sal_uInt16>( i - 6 );
2415 OUString aSuf = read_uInt16s_ToOUString(rSt, n);
2416 sal_Int32 nV = aSuf.toInt32();
2417 if ( ( nV == nVersion ) && ( aPre == "___PPT" ) )
2418 {
2419 if (!rContentHd.SeekToEndOfRecord(rSt))
2420 {
2421 break;
2422 }
2423 ReadDffRecordHeader( rSt, rContentHd );
2424 if ( rContentHd.nRecType == PPT_PST_BinaryTagData )
2425 {
2426 bRetValue = true;
2427 break;
2428 }
2429 }
2430 }
2431 }
2432 if (!aProgTagBinaryDataHd.SeekToEndOfRecord(rSt))
2433 break;
2434 }
2435 }
2436 if ( !bRetValue )
2437 rSt.Seek( nOldPos );
2438 return bRetValue;
2439}
2440
2442{
2444 if ( pList && m_nCurrentPageNum < pList->size() )
2445 return (*pList)[ m_nCurrentPageNum ].aPersistAtom.nSlideId;
2446 return 0;
2447}
2448
2450{
2451 bool bRet = false;
2453 if ( pList && ( m_nCurrentPageNum < pList->size() ) )
2454 {
2455 sal_uLong nPersist = (*pList)[ m_nCurrentPageNum ].aPersistAtom.nPsrReference;
2456 if ( nPersist > 0 && nPersist < m_nPersistPtrCnt )
2457 {
2458 sal_uLong nFPos = m_pPersistPtr[ nPersist ];
2459 if ( nFPos < nStreamLen )
2460 {
2461 rStCtrl.Seek( nFPos );
2462 if ( pRecHd )
2463 ReadDffRecordHeader( rStCtrl, *pRecHd );
2464 bRet = true;
2465 }
2466 }
2467 }
2468 return bRet;
2469}
2470
2472{
2473 PptSlidePersistList* pList = GetPageList( ePageKind );
2474 if ( pList )
2475 return pList->size();
2476 return 0;
2477}
2478
2479void SdrPowerPointImport::SetPageNum( sal_uInt16 nPageNum, PptPageKind eKind )
2480{
2481 m_eCurrentPageKind = eKind;
2482 m_nCurrentPageNum = nPageNum;
2483
2484 m_pPPTStyleSheet = nullptr;
2485
2486 bool bHasMasterPage = true;
2487 sal_uInt16 nMasterIndex = 0;
2488
2489 if ( eKind == PPT_MASTERPAGE )
2490 nMasterIndex = nPageNum;
2491 else
2492 {
2493 if ( HasMasterPage( nPageNum, eKind ) )
2494 nMasterIndex = GetMasterPageIndex( nPageNum, eKind );
2495 else
2496 bHasMasterPage = false;
2497 }
2498 if ( bHasMasterPage )
2499 {
2501 if ( pPageList && nMasterIndex < pPageList->size() )
2502 {
2503 PptSlidePersistEntry* pMasterPersist = &(*pPageList)[ nMasterIndex ];
2504 if (!pMasterPersist->xStyleSheet && pMasterPersist->aSlideAtom.nMasterId)
2505 {
2506 nMasterIndex = m_pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
2507 if ( nMasterIndex != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
2508 pMasterPersist = &(*pPageList)[ nMasterIndex ];
2509 }
2510 m_pPPTStyleSheet = pMasterPersist->xStyleSheet.get();
2511 }
2512 }
2513 if ( !m_pPPTStyleSheet )
2515}
2516
2518{
2520 Scale( aRet );
2521 // PPT works with units of 576 dpi in any case. To avoid inaccuracies
2522 // I do round the last decimal digit away.
2523 if ( nMapMul > 2 * nMapDiv )
2524 {
2525 MapUnit eMap = pSdrModel->GetScaleUnit();
2526 bool bInch = IsInch( eMap );
2527 tools::Long nInchMul = 1, nInchDiv = 1;
2528 if ( bInch )
2529 { // temporarily convert size (for rounding it) from inch to metric units
2530 Fraction aFact(GetMapFactor(eMap,MapUnit::Map100thMM).X());
2531 nInchMul = aFact.GetNumerator();
2532 nInchDiv = aFact.GetDenominator();
2533 aRet.setWidth( BigMulDiv( aRet.Width(), nInchMul, nInchDiv ) );
2534 aRet.setHeight( BigMulDiv( aRet.Height(), nInchMul, nInchDiv ) );
2535 }
2536 aRet.AdjustWidth(5 ); aRet.setWidth( aRet.Width() / 10 ); aRet.setWidth( aRet.Width() * 10 );
2537 aRet.AdjustHeight(5 ); aRet.setHeight( aRet.Height() / 10 ); aRet.setHeight( aRet.Height() * 10 );
2538 if ( bInch )
2539 {
2540 aRet.setWidth( BigMulDiv( aRet.Width(), nInchDiv, nInchMul ) );
2541 aRet.setHeight( BigMulDiv( aRet.Height(), nInchDiv, nInchMul ) );
2542 }
2543 }
2544 return aRet;
2545}
2546
2547bool SdrPowerPointImport::GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const
2548{
2550 {
2551 sal_uInt16 nSlideFlags = 0;
2553 if ( pPageList && ( m_nCurrentPageNum < pPageList->size() ) )
2554 {
2555 assert( !pPageList->is_null( m_nCurrentPageNum ) );
2556 const PptSlidePersistEntry& rE = (*pPageList)[ m_nCurrentPageNum ];
2557 nSlideFlags = rE.aSlideAtom.nFlags;
2558 if ( ! ( nSlideFlags & 2 ) )
2559 const_cast<SdrPowerPointImport*>(this)->m_aPageColors = rE.aColorScheme;
2560 }
2561 if ( nSlideFlags & 2 ) // follow master colorscheme?
2562 {
2564 if ( pPageList2 )
2565 {
2566 PptSlidePersistEntry* pMasterPersist = nullptr;
2568 pMasterPersist = &(*pPageList2)[ m_nCurrentPageNum ];
2569 else
2570 {
2572 {
2573 sal_uInt16 nMasterNum = GetMasterPageIndex( m_nCurrentPageNum, m_eCurrentPageKind );
2574 if ( nMasterNum < pPageList2->size() )
2575 pMasterPersist = &(*pPageList2)[ nMasterNum ];
2576 }
2577 }
2578 if ( pMasterPersist )
2579 {
2580 while( (pMasterPersist->aSlideAtom.nFlags & 2) // it is possible that a masterpage
2581 && pMasterPersist->aSlideAtom.nMasterId ) // itself is following a master colorscheme
2582 {
2583 auto nOrigMasterId = pMasterPersist->aSlideAtom.nMasterId;
2584 sal_uInt16 nNextMaster = m_pMasterPages->FindPage(nOrigMasterId);
2585 if (nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND)
2586 break;
2587 pMasterPersist = &(*pPageList2)[ nNextMaster ];
2588 if (pMasterPersist->aSlideAtom.nMasterId == nOrigMasterId)
2589 {
2590 SAL_WARN("filter.ms", "loop in atom chain");
2591 break;
2592 }
2593 }
2594 const_cast<SdrPowerPointImport*>(this)->m_aPageColors = pMasterPersist->aColorScheme;
2595 }
2596 }
2597 }
2598 // register current color scheme
2601 }
2602 rColor = m_aPageColors.GetColor( nNum );
2603 return true;
2604}
2605
2606bool SdrPowerPointImport::SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const
2607{
2608 bool bRet = SvxMSDffManager::SeekToShape( rSt, pClientData, nId );
2609 if (!bRet && pClientData)
2610 {
2611 ProcessData& rData = *static_cast<ProcessData*>(pClientData);
2612 PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry;
2613 if ( rPersistEntry.ePageKind == PPT_SLIDEPAGE )
2614 {
2616 {
2617 sal_uInt16 nMasterNum = GetMasterPageIndex( m_nCurrentPageNum, m_eCurrentPageKind );
2619 if ( pPageList && ( nMasterNum < pPageList->size() ) )
2620 {
2621 assert( !pPageList->is_null( nMasterNum ) );
2622 const PptSlidePersistEntry& rPersist = (*pPageList)[ nMasterNum ]; // get the masterpage's persistentry
2623 if ( rPersist.pPresentationObjects )
2624 {
2625 sal_uInt32 nCurrent(0);
2626 DffRecordList* pCList = maShapeRecords.pCList; // we got a backup of the current position
2627 if ( pCList )
2628 nCurrent = pCList->nCurrent;
2630 {
2631 sal_uInt32 nStreamPos = rSt.Tell();
2632 PPTTextObj aTextObj( rSt, const_cast<SdrPowerPointImport&>(*this), rPersistEntry, nullptr );
2633 if ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() )
2634 {
2635 sal_uInt32 nShapePos = 0;
2636 switch ( aTextObj.GetInstance() )
2637 {
2638 case TSS_Type::Title :
2639 nShapePos = rPersist.pPresentationObjects[ int(TSS_Type::PageTitle) ];
2640 break;
2641 case TSS_Type::PageTitle :
2642 nShapePos = rPersist.pPresentationObjects[ int(TSS_Type::PageTitle) ];
2643 break;
2644 case TSS_Type::Subtitle :
2645 case TSS_Type::HalfBody :
2647 case TSS_Type::Body :
2648 nShapePos = rPersist.pPresentationObjects[ int(TSS_Type::Body) ];
2649 break;
2650 default: break;
2651 }
2652 if ( nShapePos )
2653 {
2654 rSt.Seek( nShapePos );
2655 bRet = true;
2656 }
2657 }
2658 if ( !bRet )
2659 rSt.Seek( nStreamPos );
2660 }
2661 if ( pCList ) // restoring
2662 pCList->nCurrent = nCurrent;
2663 const_cast<SdrPowerPointImport*>(this)->maShapeRecords.pCList = pCList;
2664 }
2665 }
2666 }
2667 }
2668 }
2669 return bRet;
2670}
2671
2673{
2674 rtl::Reference<SdrPage> pRet = pSdrModel->AllocPage( bMaster );
2675 pRet->SetSize( GetPageSize() );
2676
2677 return pRet;
2678}
2679
2680static void ImportComment10( SvxMSDffManager const & rMan, SvStream& rStCtrl, SdrPage* pPage, DffRecordHeader const & rComment10Hd )
2681{
2682 OUString sAuthor;
2683 OUString sText;
2684 OUString sInitials;
2685
2686 sal_Int32 nIndex = 0;
2687 util::DateTime aDateTime;
2688 sal_Int32 nPosX = 0;
2689 sal_Int32 nPosY = 0;
2690
2691
2692 auto nEndRecPos = DffPropSet::SanitizeEndPos(rStCtrl, rComment10Hd.GetRecEndFilePos());
2693 while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nEndRecPos ) )
2694 {
2695 DffRecordHeader aCommentHd;
2696 ReadDffRecordHeader( rStCtrl, aCommentHd );
2697 switch( aCommentHd.nRecType )
2698 {
2699 case PPT_PST_CString :
2700 {
2701 OUString aString = SvxMSDffManager::MSDFFReadZString( rStCtrl,
2702 aCommentHd.nRecLen, true );
2703 switch ( aCommentHd.nRecInstance )
2704 {
2705 case 0 : sAuthor = aString; break;
2706 case 1 : sText = aString; break;
2707 case 2 : sInitials = aString; break;
2708 }
2709 }
2710 break;
2711
2713 {
2714 sal_uInt16 millisec = 0;
2715 rStCtrl.ReadInt32( nIndex )
2716 .ReadInt16( aDateTime.Year )
2717 .ReadUInt16( aDateTime.Month )
2718 .ReadUInt16( aDateTime.Day ) // DayOfWeek
2719 .ReadUInt16( aDateTime.Day )
2720 .ReadUInt16( aDateTime.Hours )
2721 .ReadUInt16( aDateTime.Minutes )
2722 .ReadUInt16( aDateTime.Seconds )
2723 .ReadUInt16( millisec )
2724 .ReadInt32( nPosX )
2725 .ReadInt32( nPosY );
2726
2727 aDateTime.NanoSeconds = millisec * ::tools::Time::nanoPerMilli;
2728 }
2729 break;
2730 }
2731 if (!aCommentHd.SeekToEndOfRecord(rStCtrl))
2732 break;
2733 }
2734 Point aPosition( nPosX, nPosY );
2735 rMan.Scale( aPosition );
2736
2737 try
2738 {
2739 uno::Reference< office::XAnnotationAccess > xAnnotationAccess( pPage->getUnoPage(), UNO_QUERY_THROW );
2740 uno::Reference< office::XAnnotation > xAnnotation( xAnnotationAccess->createAndInsertAnnotation() );
2741 xAnnotation->setPosition( geometry::RealPoint2D( aPosition.X() / 100.0, aPosition.Y() / 100.0 ) );
2742 xAnnotation->setAuthor( sAuthor );
2743 xAnnotation->setDateTime( aDateTime );
2744 xAnnotation->setInitials( sInitials );
2745 uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
2746 xText->setString( sText );
2747 }
2748 catch( const uno::Exception& )
2749 {
2750
2751 }
2752}
2753
2754
2755// be sure not to import masterpages with this method
2757{
2758 sal_uInt32 nOldPos = rStCtrl.Tell();
2760 if ( ( !pList ) || ( pList->size() <= m_nCurrentPageNum ) )
2761 return;
2762 PptSlidePersistEntry& rSlidePersist = (*pList)[ m_nCurrentPageNum ];
2763 if ( rSlidePersist.bStarDrawFiller )
2764 return;
2765
2766 DffRecordHeader aPageHd;
2767 if ( SeekToCurrentPage( &aPageHd ) )
2768 {
2769 rSlidePersist.xHeaderFooterEntry.reset(new HeaderFooterEntry(pMasterPersist));
2770 ProcessData aProcessData( rSlidePersist, SdPageCapsule(pRet) );
2771 auto nEndRecPos = SanitizeEndPos(rStCtrl, aPageHd.GetRecEndFilePos());
2772 while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nEndRecPos ) )
2773 {
2774 DffRecordHeader aHd;
2776 switch ( aHd.nRecType )
2777 {
2779 {
2781 }
2782 break;
2783
2784 case PPT_PST_ProgTags :
2785 {
2786 DffRecordHeader aContentDataHd;
2787 if ( SeekToContentOfProgTag( 10, rStCtrl, aHd, aContentDataHd ) )
2788 {
2789 DffRecordHeader aComment10Hd;
2790 while( ( rStCtrl.GetError() == ERRCODE_NONE ) && SeekToRec( rStCtrl, PPT_PST_Comment10, aContentDataHd.GetRecEndFilePos(), &aComment10Hd ) )
2791 {
2792 ImportComment10( *this, rStCtrl, pRet, aComment10Hd );
2793 if (!aComment10Hd.SeekToEndOfRecord(rStCtrl))
2794 break;
2795 }
2796 }
2797 }
2798 break;
2799
2800 case PPT_PST_PPDrawing :
2801 {
2802 DffRecordHeader aPPDrawHd;
2803 if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
2804 {
2805 sal_uInt32 nPPDrawOfs = rStCtrl.Tell();
2806
2807 // importing the background object before importing the page
2808 auto nPPEndRecPos = SanitizeEndPos(rStCtrl, aPPDrawHd.GetRecEndFilePos());
2809 while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nPPEndRecPos ) )
2810 {
2811 DffRecordHeader aEscherObjListHd;
2812 ReadDffRecordHeader( rStCtrl, aEscherObjListHd );
2813 switch ( aEscherObjListHd.nRecType )
2814 {
2816 {
2817 tools::Rectangle aPageSize( Point(), pRet->GetSize() );
2818 if ( rSlidePersist.aSlideAtom.nFlags & 4 ) // follow master background?
2819 {
2821 {
2822 sal_uInt16 nMasterNum = GetMasterPageIndex( m_nCurrentPageNum, m_eCurrentPageKind );
2824 PptSlidePersistEntry* pE = &(*pPageList)[ nMasterNum ];
2825 while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
2826 {
2827 auto nOrigMasterId = pE->aSlideAtom.nMasterId;
2828 sal_uInt16 nNextMaster = m_pMasterPages->FindPage(nOrigMasterId);
2829 if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
2830 break;
2831 else
2832 pE = &(*pPageList)[ nNextMaster ];
2833 if (pE->aSlideAtom.nMasterId == nOrigMasterId)
2834 {
2835 SAL_WARN("filter.ms", "loop in atom chain");
2836 break;
2837 }
2838 }
2839 if ( pE->nBackgroundOffset )
2840 {
2841 // do not follow master colorscheme?
2842 sal_uInt32 nPos = rStCtrl.Tell();
2843 rStCtrl.Seek( pE->nBackgroundOffset );
2844 rSlidePersist.pBObj = ImportObj( rStCtrl, aProcessData, aPageSize, aPageSize, /*nCalledByGroup*/0, /*pShapeId*/nullptr );
2845 rStCtrl.Seek( nPos );
2846 }
2847 }
2848 }
2849 else
2850 {
2851 DffRecordHeader aShapeHd;
2852 ReadDffRecordHeader( rStCtrl, aShapeHd );
2853 if ( aShapeHd.nRecType == DFF_msofbtSp )
2854 {
2855 sal_uInt32 nSpFlags;
2856 rStCtrl.ReadUInt32( nSpFlags ).ReadUInt32( nSpFlags );
2857 if (rStCtrl.good() && ShapeFlag(nSpFlags) & ShapeFlag::Background)
2858 {
2859 aEscherObjListHd.SeekToBegOfRecord( rStCtrl );
2860 rSlidePersist.pBObj = ImportObj( rStCtrl, aProcessData, aPageSize, aPageSize, /*nCalledByGroup*/0, /*pShapeId*/nullptr );
2861 }
2862 }
2863 }
2864 }
2865 break;
2866 }
2867 if ( aEscherObjListHd.nRecType == DFF_msofbtSpContainer )
2868 break;
2869 if (!aEscherObjListHd.SeekToEndOfRecord(rStCtrl))
2870 break;
2871 }
2872
2873 // now importing page
2874 rStCtrl.Seek( nPPDrawOfs );
2875 auto nHdEndRecPos = SanitizeEndPos(rStCtrl, aPPDrawHd.GetRecEndFilePos());
2876 while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nHdEndRecPos ) )
2877 {
2878 DffRecordHeader aEscherObjListHd;
2879 ReadDffRecordHeader( rStCtrl, aEscherObjListHd );
2880 switch ( aEscherObjListHd.nRecType )
2881 {
2883 {
2884 DffRecordHeader aShapeHd;
2885 if ( SeekToRec( rStCtrl, DFF_msofbtSpContainer, aEscherObjListHd.GetRecEndFilePos(), &aShapeHd ) )
2886 {
2887 if (!aShapeHd.SeekToEndOfRecord(rStCtrl))
2888 {
2889 break;
2890 }
2891 auto nListEndRecPos = SanitizeEndPos(rStCtrl, aEscherObjListHd.GetRecEndFilePos());
2892 while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nListEndRecPos ) )
2893 {
2894 ReadDffRecordHeader( rStCtrl, aShapeHd );
2895 if ( ( aShapeHd.nRecType == DFF_msofbtSpContainer ) || ( aShapeHd.nRecType == DFF_msofbtSpgrContainer ) )
2896 {
2897 tools::Rectangle aEmpty;
2898 aShapeHd.SeekToBegOfRecord( rStCtrl );
2899 sal_Int32 nShapeId;
2900 aProcessData.pTableRowProperties.reset();
2901 rtl::Reference<SdrObject> pObj = ImportObj( rStCtrl, aProcessData, aEmpty, aEmpty, 0, &nShapeId );
2902 if ( pObj )
2903 {
2904 if ( aProcessData.pTableRowProperties )
2905 pObj = CreateTable(pObj.get(), aProcessData.pTableRowProperties.get(), aProcessData.rPersistEntry.xSolverContainer.get(), aProcessData.aBackgroundColoredObjects);
2906
2907 pRet->NbcInsertObject( pObj.get() );
2908
2909 if( nShapeId )
2910 insertShapeId( nShapeId, pObj.get() );
2911 }
2912 }
2913 bool bSuccess = aShapeHd.SeekToEndOfRecord(rStCtrl);
2914 if (!bSuccess)
2915 break;
2916 }
2917 }
2918 }
2919 break;
2920 }
2921 if ( aEscherObjListHd.nRecType == DFF_msofbtSpgrContainer )
2922 break;
2923 if (!aEscherObjListHd.SeekToEndOfRecord(rStCtrl))
2924 break;
2925 }
2926
2927 // Handle shapes where the fill matches the background
2928 // fill (mso_fillBackground).
2929 if (rSlidePersist.ePageKind == PPT_SLIDEPAGE)
2930 {
2931 if (!aProcessData.aBackgroundColoredObjects.empty())
2932 {
2933 if (!rSlidePersist.pBObj)
2934 {
2935 for (auto const & pObject : aProcessData.aBackgroundColoredObjects)
2936 {
2937 // The shape wants a background, but the slide doesn't have
2938 // one: default to white.
2939 SfxItemSet aNewSet(*pObject->GetMergedItemSet().GetPool());
2940 aNewSet.Put(XFillStyleItem(css::drawing::FillStyle_SOLID));
2941 aNewSet.Put(XFillColorItem(OUString(), COL_WHITE));
2942 pObject->SetMergedItemSet(aNewSet);
2943 }
2944 }
2945 }
2946 }
2947
2948 if ( rSlidePersist.pBObj )
2949 {
2950 // #i99386# transfer the attributes from the temporary BackgroundObject
2951 // to the Page and delete it.
2953 pRet->getSdrPageProperties().PutItemSet(rSlidePersist.pBObj->GetMergedItemSet());
2954 if (rSlidePersist.xSolverContainer)
2955 {
2956 for (auto & pPtr : rSlidePersist.xSolverContainer->aCList)
2957 {
2958 // check connections to the group object
2959 if (pPtr->pAObj == rSlidePersist.pBObj.get())
2960 pPtr->pAObj = nullptr;
2961 if (pPtr->pBObj == rSlidePersist.pBObj.get())
2962 pPtr->pBObj = nullptr;
2963 if (pPtr->pCObj == rSlidePersist.pBObj.get())
2964 pPtr->pCObj = nullptr;
2965 }
2966 }
2967 rSlidePersist.pBObj.clear();
2968 }
2969 }
2970 }
2971 break;
2972 }
2973 if (!aHd.SeekToEndOfRecord(rStCtrl))
2974 break;
2975 }
2976 if (rSlidePersist.xSolverContainer)
2977 SolveSolver(*rSlidePersist.xSolverContainer);
2978 }
2979 rStCtrl.Seek( nOldPos );
2980}
2981
2983{
2985 if ( pPageList && m_nCurrentPageNum < pPageList->size() )
2986 {
2987 assert( !pPageList->is_null( m_nCurrentPageNum ) );
2988 return &(*pPageList)[ m_nCurrentPageNum ].aSlideAtom.aLayout;
2989 }
2990 return nullptr;
2991}
2992
2993bool SdrPowerPointImport::IsNoteOrHandout( sal_uInt16 nPageNum ) const
2994{
2995 bool bNote = m_eCurrentPageKind == PPT_NOTEPAGE;
2997 bNote = ( nPageNum & 1 ) == 0;
2998 return bNote;
2999}
3000
3001sal_uInt32 SdrPowerPointImport::GetMasterPageId( sal_uInt16 nPageNum, PptPageKind ePageKind ) const
3002{
3003 PptSlidePersistList* pPageList = GetPageList( ePageKind );
3004 if ( pPageList && nPageNum < pPageList->size() )
3005 return (*pPageList)[ nPageNum ].aSlideAtom.nMasterId;
3006 return 0;
3007}
3008
3009sal_uInt32 SdrPowerPointImport::GetNotesPageId( sal_uInt16 nPageNum ) const
3010{
3012 if ( pPageList && nPageNum < pPageList->size() )
3013 return (*pPageList)[ nPageNum ].aSlideAtom.nNotesId;
3014 return 0;
3015}
3016
3017bool SdrPowerPointImport::HasMasterPage( sal_uInt16 nPageNum, PptPageKind ePageKind ) const
3018{
3019 if ( ePageKind == PPT_NOTEPAGE )
3020 return aDocAtom.nNotesMasterPersist != 0;
3021 if ( ePageKind == PPT_MASTERPAGE )
3022 return false;
3023 return GetMasterPageId( nPageNum, ePageKind ) != 0;
3024}
3025
3026sal_uInt16 SdrPowerPointImport::GetMasterPageIndex( sal_uInt16 nPageNum, PptPageKind ePageKind ) const
3027{
3028 sal_uInt16 nIdx = 0;
3029 if ( ePageKind == PPT_NOTEPAGE )
3030 return 2;
3031 sal_uInt32 nId = GetMasterPageId( nPageNum, ePageKind );
3032 if (nId && m_pMasterPages)
3033 {
3034 nIdx = m_pMasterPages->FindPage( nId );
3035 if ( nIdx == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
3036 nIdx = 0;
3037 }
3038 return nIdx;
3039}
3040
3042{
3044 std::optional<SfxItemSet> pSet;
3045 sal_uInt64 nOldFPos = rStCtrl.Tell(); // remember FilePos for restoring it later
3046 DffRecordHeader aPageHd;
3047 if ( SeekToCurrentPage( &aPageHd ) )
3048 { // and now search for the background attributes of the Page
3049 sal_uLong nPageRecEnd = aPageHd.GetRecEndFilePos();
3050 DffRecordHeader aPPDrawHd;
3051 if ( SeekToRec( rStCtrl, PPT_PST_PPDrawing, nPageRecEnd, &aPPDrawHd ) )
3052 {
3053 sal_uLong nPPDrawEnd = aPPDrawHd.GetRecEndFilePos();
3054 DffRecordHeader aEscherF002Hd;
3055 if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, nPPDrawEnd, &aEscherF002Hd ) )
3056 {
3057 sal_uLong nEscherF002End = aEscherF002Hd.GetRecEndFilePos();
3058 DffRecordHeader aEscherObjectHd;
3059 if ( SeekToRec( rStCtrl, DFF_msofbtSpContainer, nEscherF002End, &aEscherObjectHd ) )
3060 {
3061 nBgFileOffset = aEscherObjectHd.GetRecBegFilePos();
3062 //sal_uLong nEscherObjectEnd = aEscherObjectHd.GetRecEndFilePos();
3063 //DffRecordHeader aEscherPropertiesHd;
3064 if ( SeekToRec( rStCtrl, DFF_msofbtOPT,nEscherF002End ) )
3065 {
3066 ReadDffPropSet( rStCtrl, static_cast<DffPropertyReader&>(*this) );
3068 sal_uInt32 nColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff );
3069 pSet.emplace( pSdrModel->GetItemPool() );
3070 DffObjData aObjData( aEscherObjectHd, tools::Rectangle( 0, 0, 28000, 21000 ), 0 );
3071 ApplyAttributes( rStCtrl, *pSet, aObjData );
3072 Color aColor( MSO_CLR_ToColor( nColor ) );
3073 pSet->Put( XFillColorItem( OUString(), aColor ) );
3074 }
3075 }
3076 }
3077 }
3078 }
3079 rStCtrl.Seek( nOldFPos ); // restore FilePos
3080 if ( !pSet )
3081 {
3082 pSet.emplace( pSdrModel->GetItemPool() );
3083 pSet->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
3084 }
3085 pSet->Put( XLineStyleItem( drawing::LineStyle_NONE ) );
3086 tools::Rectangle aRect(
3087 rPage.GetLeftBorder(),
3088 rPage.GetUpperBorder(),
3089 rPage.GetWidth() - rPage.GetRightBorder(),
3090 rPage.GetHeight() - rPage.GetLowerBorder());
3091
3092 pRet = new SdrRectObj(
3093 *pSdrModel,
3094 aRect);
3095
3096 pRet->SetMergedItemSet(*pSet);
3097 pRet->SetMarkProtect( true );
3098 pRet->SetMoveProtect( true );
3099 pRet->SetResizeProtect( true );
3100 return pRet;
3101}
3102
3104 pMasterPersist ( pMPE ),
3105 nAtom ( 0 )
3106{
3107 if ( pMPE )
3108 {
3109 HeaderFooterEntry* pMHFE = pMPE->xHeaderFooterEntry.get();
3110 if ( pMHFE )
3111 {
3112 nAtom = pMPE->xHeaderFooterEntry->nAtom;
3113 pPlaceholder[ 0 ] = pMHFE->pPlaceholder[ 0 ];
3114 pPlaceholder[ 1 ] = pMHFE->pPlaceholder[ 1 ];
3115 pPlaceholder[ 2 ] = pMHFE->pPlaceholder[ 2 ];
3116 pPlaceholder[ 3 ] = pMHFE->pPlaceholder[ 3 ];
3117 }
3118 }
3119}
3120
3121sal_uInt32 HeaderFooterEntry::IsToDisplay( sal_uInt32 nInstance )
3122{
3123 sal_uInt32 nMask = 0;
3124 switch ( nInstance )
3125 {
3126 case 0 : nMask = 0x010000; break;
3127 case 1 : nMask = 0x100000; break;
3128 case 2 : nMask = 0x200000; break;
3129 case 3 : nMask = 0x080000; break;
3130 }
3131 return ( nAtom & nMask );
3132}
3133
3134// The following method checks if the slide is using a different colorscheme than
3135// its master, if this is the fact, then the HeaderFooter must probably be
3136// imported as real sdrobject. In this case, the return value is the offset to the
3137// master header footer object, so it can be re-loaded with a different color set
3138sal_uInt32 HeaderFooterEntry::NeedToImportInstance( const sal_uInt32 nInstance, const PptSlidePersistEntry& rSlidePersist )
3139{
3140 sal_uInt32 nRet = 0;
3141 if ( pMasterPersist )
3142 {
3143 if ( !( rSlidePersist.aSlideAtom.nFlags & 2 ) )
3144 { // not following the master persist, so we have to check if the colors are changed
3145 if ( memcmp( &rSlidePersist.aColorScheme, &pMasterPersist->aColorScheme, 32 ) )
3146 {
3147 nRet = pMasterPersist->HeaderFooterOfs[ nInstance ];
3148 }
3149 }
3150 }
3151 return nRet;
3152}
3153
3155{
3156 rHd.SeekToContent( rStCtrl );
3157 auto nEndRecPos = SanitizeEndPos(rStCtrl, rHd.GetRecEndFilePos());
3158 while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nEndRecPos ) )
3159 {
3160 DffRecordHeader aHd;
3162 switch ( aHd.nRecType )
3163 {
3165 rStCtrl.ReadUInt32( rE.nAtom );
3166 break;
3167
3168 case PPT_PST_CString :
3169 {
3170 if ( aHd.nRecInstance < 4 )
3171 {
3173 aHd.nRecLen, true );
3174 }
3175 }
3176 break;
3177 }
3178 if (!aHd.SeekToEndOfRecord(rStCtrl))
3179 break;
3180 }
3181}
3182
3183PPTBuGraEntry::PPTBuGraEntry( Graphic aGraphic, sal_uInt32 nInst ) :
3184 nInstance ( nInst ),
3185 aBuGra (std::move( aGraphic )) {}
3186
3188: mnExtParagraphMask( 0 )
3189, mnBuBlip( 0xffff )
3190, mnHasAnm( 0 )
3191, mnAnmScheme( 0 )
3192, mpfPP10Ext( 0 )
3193, mnExtCharacterMask( 0 )
3194, mcfPP10Ext( 0 )
3195, mbSet( false )
3196{}
3197
3199{
3200 rLevel.mbSet = true;
3201 rIn.ReadUInt32( rLevel.mnExtParagraphMask );
3202 if ( rLevel.mnExtParagraphMask & 0x00800000 )
3203 rIn.ReadUInt16( rLevel.mnBuBlip );
3204 if ( rLevel.mnExtParagraphMask & 0x02000000 )
3205 rIn.ReadUInt16( rLevel.mnHasAnm );
3206 if ( rLevel.mnExtParagraphMask & 0x01000000 )
3207 rIn.ReadUInt32( rLevel.mnAnmScheme );
3208 if ( rLevel.mnExtParagraphMask & 0x04000000 )
3209 rIn.ReadUInt32( rLevel.mpfPP10Ext );
3210 rIn.ReadUInt32( rLevel.mnExtCharacterMask );
3211 if ( rLevel.mnExtCharacterMask & 0x100000 )
3212 rIn.ReadUInt32( rLevel.mcfPP10Ext );
3213 return rIn;
3214}
3215
3216bool PPTExtParaProv::GetGraphic( sal_uInt32 nInstance, Graphic& rGraph ) const
3217{
3218 bool bRetValue = false;
3219 PPTBuGraEntry* pPtr = nullptr;
3220 if ( nInstance < aBuGraList.size() )
3221 {
3222 pPtr = aBuGraList[ nInstance ].get();
3223 if ( pPtr->nInstance == nInstance )
3224 bRetValue = true;
3225 }
3226 if ( !bRetValue )
3227 {
3228 for (std::unique_ptr<PPTBuGraEntry> const & i : aBuGraList)
3229 {
3230 pPtr = i.get();
3231 if ( pPtr->nInstance == nInstance )
3232 {
3233 bRetValue = true;
3234 break;
3235 }
3236 }
3237 }
3238 if ( bRetValue )
3239 rGraph = pPtr->aBuGra;
3240 return bRetValue;
3241}
3242
3244 bStyles ( false )
3245{
3246 sal_uInt32 nOldPos = rSt.Tell();
3247
3248 // here we have to get the graphical bullets...
3249
3250 DffRecordHeader aHd;
3251 DffRecordHeader aContentDataHd;
3252
3254 if( pListHd )
3255 pListHd->SeekToContent( rSt );
3256 if ( pListHd && SdrPowerPointImport::SeekToContentOfProgTag( 9, rSt, *pListHd, aContentDataHd ) )
3257 {
3258 auto nEndRecPos = DffPropSet::SanitizeEndPos(rSt, aContentDataHd.GetRecEndFilePos());
3259 while ( ( rSt.GetError() == ERRCODE_NONE ) && ( rSt.Tell() < nEndRecPos ) )
3260 {
3261 ReadDffRecordHeader( rSt, aHd );
3262 switch ( aHd.nRecType )
3263 {
3265 {
3266 auto nHdEndRecPos = DffPropSet::SanitizeEndPos(rSt, aHd.GetRecEndFilePos());
3267 while ( ( rSt.GetError() == ERRCODE_NONE ) && ( rSt.Tell() < nHdEndRecPos ) )
3268 {
3269 DffRecordHeader aBuGraAtomHd;
3270 ReadDffRecordHeader( rSt, aBuGraAtomHd );
3271 if ( aBuGraAtomHd.nRecType == PPT_PST_ExtendedBuGraAtom )
3272 {
3273 sal_uInt16 nType;
3274 rSt.ReadUInt16( nType );
3275 Graphic aGraphic;
3276 if ( SvxMSDffManager::GetBLIPDirect( rSt, aGraphic ) )
3277 {
3278 sal_uInt32 nInstance = aBuGraAtomHd.nRecInstance;
3279 PPTBuGraEntry* pBuGra = new PPTBuGraEntry( std::move(aGraphic), nInstance );
3280 size_t n = 0;
3281 size_t nBuGraCount = aBuGraList.size();
3282 if ( nBuGraCount )
3283 {
3284 if ( aBuGraList[ nBuGraCount - 1 ]->nInstance < nInstance )
3285 n = nBuGraCount;
3286 else
3287 { // maybe the instances are not sorted, we sort it
3288 for ( n = 0; n < nBuGraCount; n++ )
3289 { // sorting fields ( hi >> lo )
3290 if ( aBuGraList[ n ]->nInstance < nInstance )
3291 break;
3292 }
3293 }
3294 }
3295 if ( n < nBuGraCount ) {
3296 aBuGraList.emplace( aBuGraList.begin() + n, pBuGra );
3297 } else {
3298 aBuGraList.emplace_back( pBuGra );
3299 }
3300 }
3301#ifdef DBG_UTIL
3302 else OSL_FAIL( "PPTExParaProv::PPTExParaProv - bullet graphic is not valid (SJ)" );
3303#endif
3304 }
3305#ifdef DBG_UTIL
3306 else OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom interpreting the PPT_PST_ExtendedBuGraContainer (SJ)" );
3307#endif
3308 if (!aBuGraAtomHd.SeekToEndOfRecord(rSt))
3309 break;
3310 }
3311 }
3312 break;
3313
3316 break;
3317#ifdef DBG_UTIL
3318 default :
3319 OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom reading ppt2000 num rules (SJ)" );
3320 break;
3321 case PPT_PST_MasterText : // first seen in: ms-tt02.ppt
3322 case PPT_PST_SrKinsoku :
3329 break;
3330#endif
3331 }
3332 if (!aHd.SeekToEndOfRecord(rSt))
3333 break;
3334 }
3335 }
3336
3337 if ( pHd && SdrPowerPointImport::SeekToContentOfProgTag( 9, rSt, *pHd, aContentDataHd ) )
3338 { // get the extended paragraph styles on mainmaster ( graphical bullets, num ruling ... )
3339 auto nEndRecPos = DffPropSet::SanitizeEndPos(rSt, aContentDataHd.GetRecEndFilePos());
3340 while ( ( rSt.GetError() == ERRCODE_NONE ) && ( rSt.Tell() < nEndRecPos ) )
3341 {
3342 ReadDffRecordHeader( rSt, aHd );
3343 switch ( aHd.nRecType )
3344 {
3346 {
3348 {
3349 sal_uInt16 nDepth = 0, i = 0;
3350 rSt.ReadUInt16(nDepth);
3351 nDepth = std::min<sal_uInt16>(nDepth, nMaxPPTLevels);
3352 auto nHdEndRecPos = DffPropSet::SanitizeEndPos(rSt, aHd.GetRecEndFilePos());
3353 while ( ( rSt.GetError() == ERRCODE_NONE ) && ( rSt.Tell() < nHdEndRecPos ) && ( i < nDepth ) )
3354 {
3355 bStyles = true;
3356 ReadPPTExtParaLevel( rSt, aExtParaSheet[ static_cast<TSS_Type>(aHd.nRecInstance) ].aExtParaLevel[ i++ ] );
3357 }
3358#ifdef DBG_UTIL
3359 if ( rSt.Tell() != aHd.GetRecEndFilePos() )
3360 OSL_FAIL( "PPTExParaProv::PPTExParaProv - error reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
3361#endif
3362 }
3363#ifdef DBG_UTIL
3364 else OSL_FAIL( "PPTExParaProv::PPTExParaProv - instance out of range (SJ)" );
3365#endif
3366 }
3367 break;
3368 default :
3369 OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom, assuming PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
3370 break;
3372 case PPT_PST_BuildList :
3375 case 0xf144 :
3376 break;
3377 }
3378 if (!aHd.SeekToEndOfRecord(rSt))
3379 break;
3380 }
3381 }
3382 rSt.Seek( nOldPos );
3383}
3384
3386{
3387}
3388
3389PPTNumberFormatCreator::PPTNumberFormatCreator( std::unique_ptr<PPTExtParaProv> pParaProv )
3390 : nIsBullet(0)
3391 , nBulletChar(0)
3392 , nBulletFont(0)
3393 , nBulletHeight(0)
3394 , nBulletColor(0)
3395 , nTextOfs(0)
3396 , nBulletOfs(0)
3397 , pExtParaProv(std::move(pParaProv))
3398{
3399}
3400
3402{
3403}
3404
3406 SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel, TSS_Type nInstance, TSS_Type nDestinationInstance,
3407 std::optional< sal_Int16 >& rStartNumbering, sal_uInt32 nFontHeight, PPTParagraphObj const * pPara )
3408{
3409 bool bHardAttribute = ( nDestinationInstance == TSS_Type::Unknown );
3410
3411 sal_uInt32 nBuFlags = 0;
3412 sal_uInt16 nHasAnm = 0;
3413 sal_uInt32 nAnmScheme = 0xFFFF0003;
3414 sal_uInt16 nBuBlip = 0xffff;
3415
3416 const PPTExtParaProv* pParaProv = pExtParaProv.get();
3417 if ( !pExtParaProv )
3418 pParaProv = pPara ? pPara->mrStyleSheet.pExtParaProv.get()
3419 : rManager.m_pPPTStyleSheet->pExtParaProv.get();
3420 if ( pPara )
3421 {
3422 nBuFlags = pPara->mxParaSet->mnExtParagraphMask;
3423 if ( nBuFlags )
3424 {
3425 if ( nBuFlags & 0x00800000 )
3426 nBuBlip = pPara->mxParaSet->mnBuBlip;
3427 if ( nBuFlags & 0x01000000 )
3428 nAnmScheme = pPara->mxParaSet->mnAnmScheme;
3429 if ( nBuFlags & 0x02000000 )
3430 nHasAnm = pPara->mxParaSet->mnHasAnm;
3431 bHardAttribute = true;
3432 }
3433 }
3434
3435 if ( ( nBuFlags & 0x03800000 ) != 0x03800000 ) // merge style sheet
3436 {
3437 // we have to read the master attributes
3438 if (pParaProv && nLevel < nMaxPPTLevels)
3439 {
3440 if ( pParaProv->bStyles )
3441 {
3442 const PPTExtParaLevel& rLev = pParaProv->aExtParaSheet[ nInstance ].aExtParaLevel[ nLevel ];
3443 if ( rLev.mbSet )
3444 {
3445 sal_uInt32 nMaBuFlags = rLev.mnExtParagraphMask;
3446
3447 if ( (!( nBuFlags & 0x00800000)) && ( nMaBuFlags & 0x00800000 ) )
3448 {
3449 if (!( nBuFlags & 0x02000000)) // if there is a BuStart without BuInstance,
3450 nBuBlip = rLev.mnBuBlip; // then there is no graphical Bullet possible
3451 }
3452 if ( (!( nBuFlags & 0x01000000)) && ( nMaBuFlags & 0x01000000 ) )
3453 nAnmScheme = rLev.mnAnmScheme;
3454 if ( (!( nBuFlags & 0x02000000)) && ( nMaBuFlags & 0x02000000 ) )
3455 nHasAnm = rLev.mnHasAnm;
3456 nBuFlags |= nMaBuFlags;
3457 }
3458 }
3459 }
3460 }
3461 if ( nBuBlip != 0xffff ) // set graphical bullet
3462 {
3463 Graphic aGraphic;
3464 if ( pParaProv && pParaProv->GetGraphic( nBuBlip, aGraphic ) )
3465 {
3466 SvxBrushItem aBrush( aGraphic, GPOS_MM, SID_ATTR_BRUSH );
3467 rNumberFormat.SetGraphicBrush( &aBrush );
3468 sal_uInt32 nHeight = static_cast<sal_uInt32>( static_cast<double>(nFontHeight) * 0.2540 * nBulletHeight + 0.5 );
3469 Size aPrefSize( aGraphic.GetPrefSize() );
3470 sal_uInt32 nWidth;
3471 if (aPrefSize.Height())
3472 nWidth = ( nHeight * aPrefSize.Width() ) / aPrefSize.Height();
3473 else
3474 nWidth = 0;
3475 rNumberFormat.SetGraphicSize( Size( nWidth, nHeight ) );
3476 rNumberFormat.SetNumberingType ( SVX_NUM_BITMAP );
3477 }
3478 }
3479 else if ( nHasAnm )
3480 {
3481 switch( static_cast< sal_uInt16 >( nAnmScheme ) )
3482 {
3483 default :
3484 case 0 :
3485 {
3487 rNumberFormat.SetListFormat("", ".", nLevel);
3488 }
3489 break;
3490 case 1 :
3491 {
3493 rNumberFormat.SetListFormat("", ".", nLevel);
3494 }
3495 break;
3496 case 2 :
3497 {
3498 rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
3499 rNumberFormat.SetListFormat("", ")", nLevel);
3500 }
3501 break;
3502 case 3 :
3503 {
3504 rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
3505 rNumberFormat.SetListFormat("", ".", nLevel);
3506 }
3507 break;
3508 case 4 :
3509 {
3510 rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
3511 rNumberFormat.SetListFormat("(", ")", nLevel);
3512 }
3513 break;
3514 case 5 :
3515 {
3516 rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
3517 rNumberFormat.SetListFormat("", ")", nLevel);
3518 }
3519 break;
3520 case 6 :
3521 {
3522 rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
3523 rNumberFormat.SetListFormat("", ".", nLevel);
3524 }
3525 break;
3526 case 7 :
3527 {
3528 rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
3529 rNumberFormat.SetListFormat("", ".", nLevel);
3530 }
3531 break;
3532 case 8 :
3533 {
3535 rNumberFormat.SetListFormat("(", ")", nLevel);
3536 }
3537 break;
3538 case 9 :
3539 {
3541 rNumberFormat.SetListFormat("", ")", nLevel);
3542 }
3543 break;
3544 case 10 :
3545 {
3547 rNumberFormat.SetListFormat("(", ")", nLevel);
3548 }
3549 break;
3550 case 11 :
3551 {
3553 rNumberFormat.SetListFormat("", ")", nLevel);
3554 }
3555 break;
3556 case 12 :
3557 {
3558 rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
3559 rNumberFormat.SetListFormat("(", ")", nLevel);
3560 }
3561 break;
3562 case 13 :
3563 {
3564 rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
3565 }
3566 break;
3567 case 14 :
3568 {
3569 rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
3570 rNumberFormat.SetListFormat("(", ")", nLevel);
3571 }
3572 break;
3573 case 15 :
3574 {
3575 rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
3576 rNumberFormat.SetListFormat("", ")", nLevel);
3577 }
3578 break;
3579 case 16: // Simplified Chinese.
3580 {
3582 }
3583 break;
3584 case 17: // Simplified Chinese with single-byte period.
3585 {
3587 rNumberFormat.SetListFormat("", ".", nLevel);
3588 }
3589 break;
3590 case 18: // Double byte circle numbers.
3591 case 19: // Wingdings white circle numbers.
3592 case 20: // Wingdings black circle numbers.
3593 {
3594 rNumberFormat.SetNumberingType( SVX_NUM_CIRCLE_NUMBER );
3595 }
3596 break;
3597 case 21: // Traditional Chinese.
3598 {
3600 }
3601 break;
3602 case 22: // Traditional Chinese with single-byte period.
3603 {
3605 rNumberFormat.SetListFormat("", ".", nLevel);
3606 }
3607 break;
3608 case 25: // Bidi Hebrew 2 with ANSI minus symbol.
3609 {
3610 rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_HEBREW );
3611 rNumberFormat.SetListFormat("", "-", nLevel);
3612 }
3613 break;
3614 case 26: // Japanese/Korean.
3615 {
3617 }
3618 break;
3619 case 27: // Japanese/Korean with single-byte period.
3620 {
3622 rNumberFormat.SetListFormat("", ".", nLevel);
3623 }
3624 break;
3625 case 28: // Double-byte Arabic numbers.
3626 {
3628 }
3629 break;
3630 case 29: // Double-byte Arabic numbers with double-byte period.
3631 {
3633 rNumberFormat.SetListFormat("", OUString(u'\xff0e'), nLevel);
3634 }
3635 break;
3636 case 38: // Japanese with double-byte period.
3637 {
3638 rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_LOWER_ZH ); // No such type. Instead with Lower Chinese Number
3639 rNumberFormat.SetListFormat("", OUString(u'\xff0e'), nLevel);
3640 }
3641 break;
3642 }
3643 rStartNumbering = std::optional< sal_Int16 >( nAnmScheme >> 16 );
3644 sal_Int16 nBuStart = *rStartNumbering;
3645 //The Seventh bit of nBuFlags that specifies whether fBulletHasAutoNumber exists,
3646 //and fBulletHasAutoNumber that specifies whether this paragraph has an automatic numbering scheme.
3647 if ( ( nBuFlags & 0x02000000 ) && ( nBuStart != -1 ))
3648 {
3649 rNumberFormat.SetStart( static_cast<sal_uInt16>(nBuStart) );
3650 }
3651 }
3652 return bHardAttribute;
3653}
3654
3655void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport const & rManager, SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel, const PPTParaLevel& rParaLevel, const PPTCharLevel& rCharLevel, TSS_Type nInstance )
3656{
3657 nIsBullet = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn ) ) != 0 ? 1 : 0;
3658 nBulletChar = rParaLevel.mnBulletChar;
3659
3660 bool bBuHardFont;
3661 bBuHardFont = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardFont ) ) != 0;
3662 if ( bBuHardFont )
3663 nBulletFont = rParaLevel.mnBulletFont;
3664 else
3665 nBulletFont = rCharLevel.mnFont;
3666 nBulletHeight = rParaLevel.mnBulletHeight;
3667 nBulletColor = rParaLevel.mnBulletColor;
3668 nTextOfs = rParaLevel.mnTextOfs;
3669 nBulletOfs = rParaLevel.mnBulletOfs;
3670
3671 std::optional< sal_Int16 > oStartNumbering;
3672 ImplGetExtNumberFormat( rManager, rNumberFormat, nLevel, nInstance, TSS_Type::Unknown, oStartNumbering, rCharLevel.mnFontHeight, nullptr );
3673 if ( ( rNumberFormat.GetNumberingType() != SVX_NUM_BITMAP ) && ( nBulletHeight > 0x7fff ) )
3674 nBulletHeight = rCharLevel.mnFontHeight ? ((- static_cast<sal_Int16>(nBulletHeight)) * 100 ) / rCharLevel.mnFontHeight : 100;
3675 ImplGetNumberFormat( rManager, rNumberFormat );
3676 switch ( rNumberFormat.GetNumberingType() )
3677 {
3680 case SVX_NUM_ROMAN_UPPER :
3681 case SVX_NUM_ROMAN_LOWER :
3682 case SVX_NUM_ARABIC :
3685 {
3686 sal_uInt32 nFont = rCharLevel.mnFont;
3687 const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
3688 if ( pFontEnityAtom )
3689 {
3690 vcl::Font aFont;
3691 aFont.SetCharSet( pFontEnityAtom->eCharSet );
3692 aFont.SetFamilyName( pFontEnityAtom->aName );
3693 aFont.SetFamily( pFontEnityAtom->eFamily );
3694 aFont.SetPitch( pFontEnityAtom->ePitch );
3695 rNumberFormat.SetBulletFont( &aFont );
3696 }
3697 }
3698 break;
3699 default: break;
3700 }
3701}
3702
3704 TSS_Type nDestinationInstance, std::optional< sal_Int16 >& rStartNumbering )
3705{
3706 sal_uInt32 nHardCount = 0;
3707 nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet, nDestinationInstance ) ? 1 : 0;
3708 nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletChar, nBulletChar, nDestinationInstance ) ? 1 : 0;
3709 nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletFont, nBulletFont, nDestinationInstance ) ? 1 : 0;
3710 nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletHeight, nBulletHeight, nDestinationInstance ) ? 1 : 0;
3711 nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletColor, nBulletColor, nDestinationInstance ) ? 1 : 0;
3712 nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs, nDestinationInstance ) ? 1 : 0;
3713 nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletOfs, nBulletOfs, nDestinationInstance ) ? 1 : 0;
3714
3715 if ( nIsBullet )
3716 rNumberFormat.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
3717
3718 sal_uInt32 nFontHeight = 24;
3719 PPTPortionObj* pPtr = pParaObj->First();
3720 if ( pPtr )
3721 pPtr->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance );
3722 if ( nIsBullet )
3723 nHardCount += ImplGetExtNumberFormat( rManager, rNumberFormat, pParaObj->mxParaSet->mnDepth,
3724 pParaObj->mnInstance, nDestinationInstance, rStartNumbering, nFontHeight, pParaObj ) ? 1 : 0;
3725
3726 if ( rNumberFormat.GetNumberingType() != SVX_NUM_BITMAP )
3728 if ( nHardCount )
3729 {
3730 ImplGetNumberFormat( rManager, rNumberFormat );
3731 switch ( rNumberFormat.GetNumberingType() )
3732 {
3735 case SVX_NUM_ROMAN_UPPER :
3736 case SVX_NUM_ROMAN_LOWER :
3737 case SVX_NUM_ARABIC :
3740 {
3741 if ( pPtr )
3742 {
3743 sal_uInt32 nFont;
3744 pPtr->GetAttrib( PPT_CharAttr_Font, nFont, nDestinationInstance );
3745 const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nFont );
3746 if ( pFontEnityAtom )
3747 {
3748 vcl::Font aFont;
3749 aFont.SetCharSet( pFontEnityAtom->eCharSet );
3750 aFont.SetFamilyName( pFontEnityAtom->aName );
3751 aFont.SetFamily( pFontEnityAtom->eFamily );
3752 aFont.SetPitch( pFontEnityAtom->ePitch );
3753 rNumberFormat.SetBulletFont( &aFont );
3754 }
3755 }
3756 }
3757 break;
3758 default: break;
3759 }
3760 }
3761 return nHardCount != 0;
3762}
3763
3765{
3766 vcl::Font aFont;
3767 const PptFontEntityAtom* pAtom = rManager.GetFontEnityAtom( nBulletFont );
3768 if ( pAtom )
3769 {
3770 rtl_TextEncoding eCharSet( pAtom->eCharSet );
3771 aFont.SetFamilyName( pAtom->aName );
3772 aFont.SetCharSet( eCharSet );
3773 aFont.SetFamily( pAtom->eFamily );
3774 aFont.SetPitch( pAtom->ePitch );
3775 }
3776 Color aCol( rManager.MSO_TEXT_CLR_ToColor( nBulletColor ) );
3777 aFont.SetColor( aCol );
3778
3779 sal_uInt16 nBuChar = static_cast<sal_uInt16>(nBulletChar);
3780 if ( aFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
3781 {
3782 nBuChar &= 0x00ff;
3783 nBuChar |= 0xf000;
3784 }
3785 rNumberFormat.SetBulletFont( &aFont );
3786 rNumberFormat.SetBulletChar( nBuChar );
3787 rNumberFormat.SetBulletRelSize( static_cast<sal_uInt16>(nBulletHeight) );
3788 rNumberFormat.SetBulletColor( aCol );
3789 sal_uInt32 nAbsLSpace = convertMasterUnitToMm100(nTextOfs);
3790 sal_uInt32 nFirstLineOffset = nAbsLSpace - convertMasterUnitToMm100(nBulletOfs);
3791 rNumberFormat.SetAbsLSpace( nAbsLSpace );
3792 rNumberFormat.SetFirstLineOffset( -static_cast<sal_Int32>(nFirstLineOffset) );
3793}
3794
3796{
3797 sal_uInt32 nColor = PPT_COLSCHEME_TEXT_UND_ZEILEN;
3798 sal_uInt16 nFontHeight(0);
3799 switch ( nInstance )
3800 {
3801 case TSS_Type::PageTitle :
3802 case TSS_Type::Title :
3803 {
3804 nColor = PPT_COLSCHEME_TITELTEXT;
3805 nFontHeight = 44;
3806 }
3807 break;
3808 case TSS_Type::Body :
3809 case TSS_Type::Subtitle :
3810 case TSS_Type::HalfBody :
3812 nFontHeight = 32;
3813 break;
3814 case TSS_Type::Notes :
3815 nFontHeight = 12;
3816 break;
3817 case TSS_Type::Unused :
3819 nFontHeight = 24;
3820 break;
3821 default: break;
3822 }
3823 for (PPTCharLevel & nDepth : maCharLevel)
3824 {
3825 nDepth.mnFlags = 0;
3826 nDepth.mnFont = 0;
3827 nDepth.mnAsianOrComplexFont = 0xffff;
3828 nDepth.mnFontHeight = nFontHeight;
3829 nDepth.mnFontColor = nColor;
3830 nDepth.mnFontColorInStyleSheet = Color( static_cast<sal_uInt8>(nColor), static_cast<sal_uInt8>( nColor >> 8 ), static_cast<sal_uInt8>( nColor >> 16 ) );
3831 nDepth.mnEscapement = 0;
3832 }
3833}
3834
3835void PPTCharSheet::Read( SvStream& rIn, sal_uInt32 nLevel)
3836{
3837 // character attributes
3838 sal_uInt32 nCMask(0);
3839 sal_uInt16 nVal16;
3840 rIn.ReadUInt32(nCMask);
3841
3842 if ( nCMask & 0x0000FFFF )
3843 {
3844 sal_uInt16 nBitAttr(0);
3845 maCharLevel[ nLevel ].mnFlags &= ~static_cast<sal_uInt16>(nCMask);
3846 rIn.ReadUInt16( nBitAttr ); // Bit attributes (bold, underlined, ...)
3847 maCharLevel[ nLevel ].mnFlags |= nBitAttr;
3848 }
3849 if ( nCMask & ( 1 << PPT_CharAttr_Font ) ) // 0x00010000
3850 rIn.ReadUInt16( maCharLevel[ nLevel ].mnFont );
3851 if ( nCMask & ( 1 << PPT_CharAttr_AsianOrComplexFont ) ) // 0x00200000
3852 rIn.ReadUInt16( maCharLevel[ nLevel ].mnAsianOrComplexFont );
3853 if ( nCMask & ( 1 << PPT_CharAttr_ANSITypeface ) ) // 0x00400000
3854 rIn.ReadUInt16( nVal16 );
3855 if ( nCMask & ( 1 << PPT_CharAttr_Symbol ) ) // 0x00800000
3856 rIn.ReadUInt16( nVal16 );
3857 if ( nCMask & ( 1 << PPT_CharAttr_FontHeight ) ) // 0x00020000
3858 rIn.ReadUInt16( maCharLevel[ nLevel ].mnFontHeight );
3859 if ( nCMask & ( 1 << PPT_CharAttr_FontColor ) ) // 0x00040000
3860 {
3861 rIn.ReadUInt32( maCharLevel[ nLevel ].mnFontColor );
3862 if( ! (maCharLevel[ nLevel ].mnFontColor & 0xff000000 ) )
3864 }
3865 if ( nCMask & ( 1 << PPT_CharAttr_Escapement ) ) // 0x00080000
3866 rIn.ReadUInt16( maCharLevel[ nLevel ].mnEscapement );
3867 if ( nCMask & 0x00100000 ) // 0x00100000
3868 rIn.ReadUInt16( nVal16 );
3869
3870 nCMask >>= 24;
3871 while( nCMask )
3872 {
3873 if ( nCMask & 1 )
3874 {
3875 OSL_FAIL( "PPTCharSheet::Read - unknown attribute, send me this document (SJ)" );
3876 rIn.ReadUInt16( nVal16 );
3877 }
3878 nCMask >>= 1;
3879 }
3880}
3881
3883{
3884 sal_uInt16 nBuFlags = 0;
3885 sal_uInt32 nBulletColor = 0x8000000;
3886 sal_uInt16 nUpperDist = 0;
3887
3888 switch ( nInstance )
3889 {
3890 case TSS_Type::PageTitle :
3891 case TSS_Type::Title :
3892 nBulletColor = PPT_COLSCHEME_TITELTEXT;
3893 break;
3894 case TSS_Type::Body :
3895 case TSS_Type::Subtitle :
3896 case TSS_Type::HalfBody :
3898 {
3899 nBuFlags = 1;
3900 nUpperDist = 0x14;
3901 }
3902 break;
3903 case TSS_Type::Notes :
3904 nUpperDist = 0x1e;
3905 break;
3906 default: break;
3907 }
3908 for (PPTParaLevel & i : maParaLevel)
3909 {
3910 i.mnBuFlags = nBuFlags;
3911 i.mnBulletChar = 0x2022;
3912 i.mnBulletFont = 0;
3913 i.mnBulletHeight = 100;
3914 i.mnBulletColor = nBulletColor;
3915 i.mnAdjust = 0;
3916 i.mnLineFeed = 100;
3917 i.mnLowerDist = 0;
3918 i.mnUpperDist = nUpperDist;
3919 i.mnTextOfs = 0;
3920 i.mnBulletOfs = 0;
3921 i.mnDefaultTab = 0x240;
3922 i.mnAsianLineBreak = 0;
3923 i.mnBiDi = 0;
3924 }
3925}
3926
3928#ifdef DBG_UTIL
3929 rManager
3930#endif
3931 , SvStream& rIn
3932 , sal_uInt32 nLevel, bool bFirst )
3933{
3934 // paragraph attributes
3935 sal_uInt32 nPMask(0);
3936 rIn.ReadUInt32(nPMask);
3937
3938 sal_uInt16 nMask16 = static_cast<sal_uInt16>(nPMask) & 0xf;
3939 if ( nMask16 )
3940 {
3941 sal_uInt16 nVal16(0);
3942 rIn.ReadUInt16( nVal16 );
3943 maParaLevel[ nLevel ].mnBuFlags &=~ nMask16;
3944 nVal16 &= nMask16;
3945 maParaLevel[ nLevel ].mnBuFlags |= nVal16;
3946 }
3947 if ( nPMask & 0x0080 )
3948 rIn.ReadUInt16( maParaLevel[ nLevel ].mnBulletChar );
3949 if ( nPMask & 0x0010 )
3950 rIn.ReadUInt16( maParaLevel[ nLevel ].mnBulletFont );
3951 if ( nPMask & 0x0040 )
3952 {
3953 sal_uInt16 nVal16(0);
3954 rIn.ReadUInt16( nVal16 );
3955 maParaLevel[ nLevel ].mnBulletHeight = nVal16;
3956 }
3957 if ( nPMask & 0x0020 )
3958 {
3959 sal_uInt32 nVal32(0);
3960 rIn.ReadUInt32(nVal32);
3961 maParaLevel[ nLevel ].mnBulletColor = nVal32;
3962 }
3963 if ( bFirst )
3964 {
3965 if ( nPMask & 0xF00 )
3966 {
3967 // AbsJust!
3968 sal_uInt16 nVal16(0);
3969 rIn.ReadUInt16( nVal16 );
3970 maParaLevel[ nLevel ].mnAdjust = nVal16 & 3;
3971 }
3972 if ( nPMask & 0x1000 )
3973 rIn.ReadUInt16( maParaLevel[ nLevel ].mnLineFeed );
3974 if ( nPMask & 0x2000 )
3975 rIn.ReadUInt16( maParaLevel[ nLevel ].mnUpperDist );
3976 if ( nPMask & 0x4000 )
3977 rIn.ReadUInt16( maParaLevel[ nLevel ].mnLowerDist );
3978 if ( nPMask & 0x8000 )
3979 rIn.ReadUInt16( maParaLevel[ nLevel ].mnTextOfs );
3980 if ( nPMask & 0x10000 )
3981 rIn.ReadUInt16( maParaLevel[ nLevel ].mnBulletOfs );
3982 if ( nPMask & 0x20000 )
3983 rIn.ReadUInt16( maParaLevel[ nLevel ].mnDefaultTab );
3984 if ( nPMask & 0x200000 )
3985 {
3986 sal_uInt16 nVal16;
3987 sal_uInt32 nVal32;
3988 // number of tabulators
3989 rIn.ReadUInt16( nVal16 );
3990 if (!rIn.good() || rIn.remainingSize() / sizeof(nVal32) < nVal16)
3991 return;
3992 for (sal_uInt16 i = 0; i < nVal16; ++i)
3993 rIn.ReadUInt32( nVal32 ); // reading the tabulators
3994 }
3995 if ( nPMask & 0x40000 )
3996 {
3997 sal_uInt16 nVal16;
3998 rIn.ReadUInt16( nVal16 );
3999 }
4000 if ( nPMask & 0x80000 )
4001 rIn.ReadUInt16( maParaLevel[ nLevel ].mnAsianLineBreak );
4002 if ( nPMask & 0x100000 )
4003 rIn.ReadUInt16( maParaLevel[ nLevel ].mnBiDi );
4004 }
4005 else
4006 {
4007 if ( nPMask & 0x800 )
4008 {
4009 sal_uInt16 nVal16(0);
4010 rIn.ReadUInt16( nVal16 );
4011 maParaLevel[ nLevel ].mnAdjust = nVal16 & 3;
4012 }
4013 if ( nPMask & 0x1000 )
4014 rIn.ReadUInt16( maParaLevel[ nLevel ].mnLineFeed );
4015 if ( nPMask & 0x2000 )
4016 rIn.ReadUInt16( maParaLevel[ nLevel ].mnUpperDist );
4017 if ( nPMask & 0x4000 )
4018 rIn.ReadUInt16( maParaLevel[ nLevel ].mnLowerDist );
4019 if ( nPMask & 0x8000 )
4020 {
4021 sal_uInt16 nVal16;
4022 rIn.ReadUInt16( nVal16 );
4023 }
4024 if ( nPMask & 0x100 )
4025 rIn.ReadUInt16( maParaLevel[ nLevel ].mnTextOfs );
4026 if ( nPMask & 0x200 )
4027 {
4028 sal_uInt16 nVal16;
4029 rIn.ReadUInt16( nVal16 );
4030 }
4031 if ( nPMask & 0x400 )
4032 rIn.ReadUInt16( maParaLevel[ nLevel ].mnBulletOfs );
4033 if ( nPMask & 0x10000 )
4034 {
4035 sal_uInt16 nVal16;
4036 rIn.ReadUInt16( nVal16 );
4037 }
4038 if ( nPMask & 0xe0000 )
4039 {
4040 sal_uInt16 nFlagsToModifyMask = static_cast<sal_uInt16>( ( nPMask >> 17 ) & 7 );
4041 sal_uInt16 nVal16(0);
4042 rIn.ReadUInt16( nVal16 );
4043 // bits that are not involved to zero
4044 nVal16 &= nFlagsToModifyMask;
4045 // bits that are to change to zero
4046 maParaLevel[ nLevel ].mnAsianLineBreak &=~nFlagsToModifyMask;
4047 // now set the corresponding bits
4048 maParaLevel[ nLevel ].mnAsianLineBreak |= nVal16;
4049 }
4050 if ( nPMask & 0x100000 )
4051 {
4052 sal_uInt16 nVal16;
4053 sal_uInt32 nVal32;
4054 // number of tabulators
4055 rIn.ReadUInt16( nVal16 );
4056 if (!rIn.good() || rIn.remainingSize() / sizeof(nVal32) < nVal16)
4057 return;
4058 for (sal_uInt16 i = 0; i < nVal16; ++i)
4059 rIn.ReadUInt32( nVal32 ); // reading the tabulators
4060 }
4061 if ( nPMask & 0x200000 )
4062 rIn.ReadUInt16( maParaLevel[ nLevel ].mnBiDi );
4063 }
4064
4065 nPMask >>= 22;
4066 while( nPMask )
4067 {
4068 if ( nPMask & 1 )
4069 {
4070#ifdef DBG_UTIL
4071 if (!(rManager.rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT))
4072 {
4073 OSL_FAIL( "PPTParaSheet::Read - unknown attribute, send me this document (SJ)" );
4074 }
4075#endif
4076 sal_uInt16 nVal16;
4077 rIn.ReadUInt16( nVal16 );
4078 }
4079 nPMask >>= 1;
4080 }
4081}
4082
4083void PPTParaSheet::UpdateBulletRelSize( sal_uInt32 nLevel, sal_uInt16 nFontHeight )
4084{
4085 if ( maParaLevel[ nLevel ].mnBulletHeight > 0x7fff ) // a negative value is the absolute bullet height
4086 {
4087 sal_Int16 nBulletRelSize = static_cast<sal_Int16>(maParaLevel[ nLevel ].mnBulletHeight);
4088 nBulletRelSize = nFontHeight ? ((-nBulletRelSize) * 100 ) / nFontHeight : 100;
4089 if ( nBulletRelSize < 0 ) //bullet size over flow
4090 nBulletRelSize = 100;
4091 maParaLevel[ nLevel ].mnBulletHeight = nBulletRelSize;
4092 }
4093}
4094
4096 const PPTTextParagraphStyleAtomInterpreter& rTxPFStyle,
4097 const PPTTextSpecInfo& rTextSpecInfo ) :
4098
4099 PPTNumberFormatCreator ( std::make_unique<PPTExtParaProv>( rManager, rIn, &rSlideHd ) ),
4100 maTxSI ( rTextSpecInfo )
4101{
4102 sal_uInt32 nOldFilePos = rIn.Tell();
4103
4104 // default stylesheets
4105 mpCharSheet[ TSS_Type::PageTitle ] = std::make_unique<PPTCharSheet>( TSS_Type::PageTitle );
4106 mpCharSheet[ TSS_Type::Body ] = std::make_unique<PPTCharSheet>( TSS_Type::Body );
4107 mpCharSheet[ TSS_Type::Notes ] = std::make_unique<PPTCharSheet>( TSS_Type::Notes );
4108 mpCharSheet[ TSS_Type::Unused ] = std::make_unique<PPTCharSheet>( TSS_Type::Unused ); // this entry is not used by ppt
4109 mpCharSheet[ TSS_Type::TextInShape ] = std::make_unique<PPTCharSheet>( TSS_Type::TextInShape );
4110 mpParaSheet[ TSS_Type::PageTitle ] = std::make_unique<PPTParaSheet>( TSS_Type::PageTitle );
4111 mpParaSheet[ TSS_Type::Body ] = std::make_unique<PPTParaSheet>( TSS_Type::Body );
4112 mpParaSheet[ TSS_Type::Notes ] = std::make_unique<PPTParaSheet>( TSS_Type::Notes );
4113 mpParaSheet[ TSS_Type::Unused ] = std::make_unique<PPTParaSheet>( TSS_Type::Unused );
4114 mpParaSheet[ TSS_Type::TextInShape ] = std::make_unique<PPTParaSheet>( TSS_Type::TextInShape );
4115 // mpCharSheet[ TSS_Type::QuarterBody ], mpCharSheet[ TSS_Type::HalfBody ], mpCharSheet[ TSS_Type::Title ], mpCharSheet[ TSS_Type::Subtitle ] intentionally null
4116 // mpParaSheet[ TSS_Type::QuarterBody ], mpParaSheet[ TSS_Type::HalfBody ], mpParaSheet[ TSS_Type::Title ], mpParaSheet[ TSS_Type::Subtitle ] intentionally null
4117
4118 /* SJ: try to locate the txMasterStyleAtom in the Environment
4119
4120 it seems that the environment TextStyle is having a higher priority
4121 than the TextStyle that can be found within the master page
4122 */
4123 bool bFoundTxMasterStyleAtom04 = false;
4125 if ( pEnvHeader )
4126 {
4127 pEnvHeader->SeekToContent( rIn );
4128 DffRecordHeader aTxMasterStyleHd;
4129 auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, pEnvHeader->GetRecEndFilePos());
4130 while (rIn.Tell() < nEndRecPos)
4131 {
4132 ReadDffRecordHeader( rIn, aTxMasterStyleHd );
4133 if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom )
4134 {
4135 sal_uInt16 nLevelCnt(0);
4136 rIn.ReadUInt16(nLevelCnt);
4137
4138 sal_uInt16 nLev = 0;
4139 bool bFirst = true;
4140 bFoundTxMasterStyleAtom04 = true;
4141 auto nTxEndRecPos = DffPropSet::SanitizeEndPos(rIn, aTxMasterStyleHd.GetRecEndFilePos());
4142 while (rIn.GetError() == ERRCODE_NONE && rIn.Tell() < nTxEndRecPos && nLev < nLevelCnt && nLev < nMaxPPTLevels)
4143 {
4144 if ( nLev )
4145 {
4146 mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev - 1 ];
4147 mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev - 1 ];
4148 }
4149 mpParaSheet[ TSS_Type::TextInShape ]->Read( rManager, rIn, nLev, bFirst );
4150 if ( !nLev )
4151 {
4152 // set paragraph defaults for instance 4 (TSS_Type::TextInShape)
4153 if ( rTxPFStyle.bValid )
4154 {
4155 PPTParaLevel& rParaLevel = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ 0 ];
4156 rParaLevel.mnAsianLineBreak = 0;
4157 if ( rTxPFStyle.bForbiddenRules )
4158 rParaLevel.mnAsianLineBreak |= 1;
4159 if ( !rTxPFStyle.bLatinTextWrap )
4160 rParaLevel.mnAsianLineBreak |= 2;
4161 if ( rTxPFStyle.bHangingPunctuation )
4162 rParaLevel.mnAsianLineBreak |= 4;
4163 }
4164 }
4165 mpCharSheet[ TSS_Type::TextInShape ]->Read( rIn, nLev );
4166 mpParaSheet[ TSS_Type::TextInShape ]->UpdateBulletRelSize( nLev, mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ].mnFontHeight );
4167 bFirst = false;
4168 nLev++;
4169 }
4170 break;
4171 }
4172 else
4173 {
4174 if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn))
4175 break;
4176 }
4177 }
4178 }
4179
4180 rSlideHd.SeekToContent( rIn );
4181
4182 DffRecordHeader aTxMasterStyleHd;
4183 auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, rSlideHd.GetRecEndFilePos());
4184 while (rIn.Tell() < nEndRecPos)
4185 {
4186 ReadDffRecordHeader( rIn, aTxMasterStyleHd );
4187 if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom )
4188 break;
4189 else
4190 {
4191 if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn))
4192 break;
4193 }
4194 }
4195 while ( ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) && ( rIn.Tell() < nEndRecPos ) ) //TODO: aTxMasterStyleHd may be used without having been properly initialized
4196 {
4197 TSS_Type nInstance = static_cast<TSS_Type>(aTxMasterStyleHd.nRecInstance);
4198 if ( ( nInstance <= TSS_Type::LAST ) &&
4199 ( ( nInstance != TSS_Type::TextInShape ) || !bFoundTxMasterStyleAtom04 ) )
4200 {
4201 if ( nInstance > TSS_Type::TextInShape )
4202 {
4203 mpCharSheet[ nInstance ].reset(); // be sure to delete the old one if this instance comes twice
4204 mpParaSheet[ nInstance ].reset();
4205
4206 switch ( nInstance )
4207 {
4208 case TSS_Type::Subtitle :
4209 {
4210 mpCharSheet[ TSS_Type::Subtitle ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::Body ] ) );
4211 mpParaSheet[ TSS_Type::Subtitle ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::Body ] ) );
4212 }
4213 break;
4214 case TSS_Type::Title :
4215 {
4216 mpCharSheet[ TSS_Type::Title ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::PageTitle ] ) );
4217 mpParaSheet[ TSS_Type::Title ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::PageTitle ] ) );
4218 }
4219 break;
4220 case TSS_Type::HalfBody :
4221 {
4222 mpCharSheet[ TSS_Type::HalfBody ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::Body ] ) );
4223 mpParaSheet[ TSS_Type::HalfBody ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::Body ] ) );
4224 }
4225 break;
4226
4228 {
4229 mpCharSheet[ TSS_Type::QuarterBody ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::Body ] ) );
4230 mpParaSheet[ TSS_Type::QuarterBody ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::Body ] ) );
4231 }
4232 break;
4233 default: break;
4234 }
4235 }
4236 sal_uInt16 nLevelCnt(0);
4237 rIn.ReadUInt16(nLevelCnt);
4238 if (nLevelCnt > nMaxPPTLevels)
4239 {
4240 OSL_FAIL( "PPTStyleSheet::Ppt-TextStylesheet has more than 5 levels! (SJ)" );
4241 nLevelCnt = nMaxPPTLevels;
4242 }
4243 sal_uInt16 nLev = 0;
4244 bool bFirst = true;
4245
4246 auto nTxEndRecPos = DffPropSet::SanitizeEndPos(rIn, aTxMasterStyleHd.GetRecEndFilePos());
4247 while ( rIn.GetError() == ERRCODE_NONE && rIn.Tell() < nTxEndRecPos && nLev < nLevelCnt )
4248 {
4249 if ( nLev && ( nInstance < TSS_Type::Subtitle ) )
4250 {
4251 mpParaSheet[ nInstance ]->maParaLevel[ nLev ] = mpParaSheet[ nInstance ]->maParaLevel[ nLev - 1 ];
4252 mpCharSheet[ nInstance ]->maCharLevel[ nLev ] = mpCharSheet[ nInstance ]->maCharLevel[ nLev - 1 ];
4253 }
4254
4255 // Exception: Template 5, 6 (MasterTitle Title and SubTitle)
4256 if ( nInstance >= TSS_Type::Subtitle )
4257 {
4258 bFirst = false;
4259
4260 sal_uInt16 nDontKnow;
4261 rIn.ReadUInt16( nDontKnow );
4262 }
4263 mpParaSheet[ nInstance ]->Read( rManager, rIn, nLev, bFirst );
4264 mpCharSheet[ nInstance ]->Read( rIn, nLev );
4265 mpParaSheet[ nInstance ]->UpdateBulletRelSize( nLev, mpCharSheet[ nInstance ]->maCharLevel[ nLev ].mnFontHeight );
4266 bFirst = false;
4267 nLev++;
4268 }
4269#ifdef DBG_UTIL
4271 {
4272 if ( rIn.GetError() == ERRCODE_NONE )
4273 {
4274 OStringBuffer aMsg;
4275 if ( rIn.Tell() > aTxMasterStyleHd.GetRecEndFilePos() )
4276 {
4277 aMsg.append("\n reading too many bytes:" +
4278 OString::number(rIn.Tell() - aTxMasterStyleHd.GetRecEndFilePos()));
4279 }
4280 if ( rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() )
4281 {
4282 aMsg.append("\n reading too few bytes:" +
4283 OString::number(aTxMasterStyleHd.GetRecEndFilePos() - rIn.Tell()));
4284 }
4285 if (aMsg.getLength())
4286 {
4287 aMsg.insert(0, "PptStyleSheet::operator>>[]");
4288 OSL_FAIL(aMsg.getStr());
4289 }
4290 }
4291 if ( rIn.Tell() != aTxMasterStyleHd.GetRecEndFilePos() )
4292 SAL_WARN( "filter.ms", "SJ: Wrong number of bytes read during import of PPT style");
4293 }
4294#endif
4295 }
4296 if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn))
4297 break;
4298 ReadDffRecordHeader( rIn, aTxMasterStyleHd );
4299 }
4301 {
4302 mpCharSheet[ TSS_Type::Subtitle ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::Body ] ) );
4303 mpParaSheet[ TSS_Type::Subtitle ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::Body ] ) );
4304 }
4305 if ( !mpCharSheet[ TSS_Type::Title ] )
4306 {
4307 mpCharSheet[ TSS_Type::Title ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::PageTitle ] ) );
4308 mpParaSheet[ TSS_Type::Title ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::PageTitle ] ) );
4309 }
4311 {
4312 mpCharSheet[ TSS_Type::HalfBody ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::Body ] ) );
4313 mpParaSheet[ TSS_Type::HalfBody ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::Body ] ) );
4314 }
4316 {
4317 mpCharSheet[ TSS_Type::QuarterBody ] = std::make_unique<PPTCharSheet>( *( mpCharSheet[ TSS_Type::Body ] ) );
4318 mpParaSheet[ TSS_Type::QuarterBody ] = std::make_unique<PPTParaSheet>( *( mpParaSheet[ TSS_Type::Body ] ) );
4319 }
4320 if ( !bFoundTxMasterStyleAtom04 )
4321 { // try to locate the txMasterStyleAtom in the Environment
4323 if ( pEnvHeader2 )
4324 {
4325 pEnvHeader2->SeekToContent( rIn );
4326 DffRecordHeader aTxMasterStyleHd2;
4327 auto nEnvEndRecPos = DffPropSet::SanitizeEndPos(rIn, pEnvHeader2->GetRecEndFilePos());
4328 while (rIn.Tell() < nEnvEndRecPos)
4329 {
4330 ReadDffRecordHeader( rIn, aTxMasterStyleHd2 );
4331 if ( aTxMasterStyleHd2.nRecType == PPT_PST_TxMasterStyleAtom )
4332 {
4333 sal_uInt16 nLevelCnt;
4334 rIn.ReadUInt16( nLevelCnt );
4335
4336 sal_uInt16 nLev = 0;
4337 bool bFirst = true;
4338 auto nTxEndRecPos = DffPropSet::SanitizeEndPos(rIn, aTxMasterStyleHd2.GetRecEndFilePos());
4339 while ( rIn.GetError() == ERRCODE_NONE && rIn.Tell() < nTxEndRecPos && nLev < nLevelCnt )
4340 {
4341 if ( nLev )
4342 {
4343 mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev - 1 ];
4344 mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev - 1 ];
4345 }
4346 mpParaSheet[ TSS_Type::TextInShape ]->Read( rManager, rIn, nLev, bFirst );
4347 if ( !nLev )
4348 {
4349 // set paragraph defaults for instance 4 (TSS_Type::TextInShape)
4350 if ( rTxPFStyle.bValid )
4351 {
4352 PPTParaLevel& rParaLevel = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ 0 ];
4353 rParaLevel.mnAsianLineBreak = 0;
4354 if ( rTxPFStyle.bForbiddenRules )
4355 rParaLevel.mnAsianLineBreak |= 1;
4356 if ( !rTxPFStyle.bLatinTextWrap )
4357 rParaLevel.mnAsianLineBreak |= 2;
4358 if ( rTxPFStyle.bHangingPunctuation )
4359 rParaLevel.mnAsianLineBreak |= 4;
4360 }
4361 }
4362 mpCharSheet[ TSS_Type::TextInShape ]->Read( rIn, nLev );
4363 mpParaSheet[ TSS_Type::TextInShape ]->UpdateBulletRelSize( nLev, mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ].mnFontHeight );
4364 bFirst = false;
4365 nLev++;
4366 }
4367 break;
4368 }
4369 else
4370 {
4371 if (!aTxMasterStyleHd2.SeekToEndOfRecord(rIn))
4372 break;
4373 }
4374 }
4375 }
4376 }
4377 rIn.Seek( nOldFilePos );
4378
4379 // will create the default numbulletitem for each instance
4380 for ( auto i : o3tl::enumrange<TSS_Type>() )
4381 {
4382 sal_uInt16 nLevels, nDepth = 0;
4383 SvxNumRuleType eNumRuleType;
4384
4385 switch ( i )
4386 {
4387 case TSS_Type::PageTitle :
4388 case TSS_Type::Title :
4389 nLevels = 1;
4390 eNumRuleType = SvxNumRuleType::NUMBERING;
4391 break;
4392 case TSS_Type::Subtitle :
4393 nLevels = SVX_MAX_NUM;
4394 eNumRuleType = SvxNumRuleType::NUMBERING;
4395 break;
4396 case TSS_Type::Body :
4397 case TSS_Type::HalfBody :
4399 nLevels = SVX_MAX_NUM;
4400 eNumRuleType = SvxNumRuleType::PRESENTATION_NUMBERING;
4401 break;
4402 default :
4403 case TSS_Type::Notes :
4404 case TSS_Type::Unused :
4406 nLevels = SVX_MAX_NUM;
4407 eNumRuleType = SvxNumRuleType::NUMBERING;
4408 break;
4409 }
4410 SvxNumRule aRule( SvxNumRuleFlags::BULLET_REL_SIZE | SvxNumRuleFlags::BULLET_COLOR,
4411 nLevels, false, eNumRuleType );
4412 for ( sal_uInt16 nCount = 0; nDepth < nLevels; nCount++ )
4413 {
4414 const PPTParaLevel& rParaLevel = mpParaSheet[ i ]->maParaLevel[ nCount ];
4415 const PPTCharLevel& rCharLevel = mpCharSheet[ i ]->maCharLevel[ nCount ];
4416 SvxNumberFormat aNumberFormat( SVX_NUM_CHAR_SPECIAL );
4417 aNumberFormat.SetBulletChar( ' ' );
4418 GetNumberFormat( rManager, aNumberFormat, nCount, rParaLevel, rCharLevel, i );
4419 aRule.SetLevel( nDepth++, aNumberFormat );
4420 if ( nCount >= 4 )
4421 {
4422 for ( ;nDepth < nLevels; nDepth++ )
4423 aRule.SetLevel( nDepth, aNumberFormat );
4424 }
4425 }
4426 mpNumBulletItem[ i ] = std::make_unique<SvxNumBulletItem>( std::move(aRule), EE_PARA_NUMBULLET );
4427 }
4428}
4429
4431{
4432 for ( auto i : o3tl::enumrange<TSS_Type>() )
4433 {
4434 mpCharSheet[i].reset();
4435 mpParaSheet[i].reset();
4436 mpNumBulletItem[i].reset();
4437 }
4438}
4439
4441 : mnOriginalTextPos(0)
4442 , mxParaSet( new ImplPPTParaPropSet )
4443{
4444 mxParaSet->mnHasAnm = 1;
4445}
4446
4448{
4449 mxParaSet = rParaPropSet.mxParaSet;
4450 mnOriginalTextPos = rParaPropSet.mnOriginalTextPos;
4451}
4452
4454{
4455}
4456
4458{
4459 if ( this != &rParaPropSet )
4460 {
4461 mxParaSet = rParaPropSet.mxParaSet;
4462 mnOriginalTextPos = rParaPropSet.mnOriginalTextPos;
4463 }
4464 return *this;
4465}
4466
4468 : mnOriginalTextPos(0)
4469 , mnParagraph(nParagraph)
4470{
4472 mbIsHyperlink = false;
4473 mbHardHylinkOrigColor = false;
4474 mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = LANGUAGE_SYSTEM;
4475}
4476
4478 : mpImplPPTCharPropSet( rCharPropSet.mpImplPPTCharPropSet )
4479{
4480 mnHylinkOrigColor = rCharPropSet.mnHylinkOrigColor;
4481 mbIsHyperlink = rCharPropSet.mbIsHyperlink;
4483
4484 mnParagraph = rCharPropSet.mnParagraph;
4485 mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
4486 maString = rCharPropSet.maString;
4487 mpFieldItem.reset( rCharPropSet.mpFieldItem ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr );
4488 mnLanguage[ 0 ] = rCharPropSet.mnLanguage[ 0 ];
4489 mnLanguage[ 1 ] = rCharPropSet.mnLanguage[ 1 ];
4490 mnLanguage[ 2 ] = rCharPropSet.mnLanguage[ 2 ];
4491}
4492
4493PPTCharPropSet::PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph )
4494 : mpImplPPTCharPropSet(rCharPropSet.mpImplPPTCharPropSet)
4495{
4496 mnHylinkOrigColor = rCharPropSet.mnHylinkOrigColor;
4497 mbIsHyperlink = rCharPropSet.mbIsHyperlink;
4499
4500 mnParagraph = nParagraph;
4501 mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
4502 maString = rCharPropSet.maString;
4503 mpFieldItem.reset( rCharPropSet.mpFieldItem ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr );
4504 mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = LANGUAGE_SYSTEM;
4505}
4506
4508{
4509}
4510
4512{
4513 if ( this != &rCharPropSet )
4514 {
4516 mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
4517 mnParagraph = rCharPropSet.mnParagraph;
4518 maString = rCharPropSet.maString;
4519 mpFieldItem.reset( rCharPropSet.mpFieldItem ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr );
4520 }
4521 return *this;
4522}
4523
4524void PPTCharPropSet::SetFont( sal_uInt16 nFont )
4525{
4526 sal_uInt32 nMask = 1 << PPT_CharAttr_Font;
4527 bool bDoNotMake = (mpImplPPTCharPropSet->mnAttrSet & nMask) != 0;
4528
4529 if ( bDoNotMake )
4530 bDoNotMake = nFont == mpImplPPTCharPropSet->mnFont;
4531
4532 if ( !bDoNotMake )
4533 {
4534 mpImplPPTCharPropSet->mnFont = nFont;
4535 mpImplPPTCharPropSet->mnAttrSet |= nMask;
4536 }
4537}
4538
4539void PPTCharPropSet::SetColor( sal_uInt32 nColor )
4540{
4541 mpImplPPTCharPropSet->mnColor = nColor;
4543}
4544
4546 : nFlags(0)
4547 , nDefaultTab(0x240)
4548 , nTabCount(0)
4549{
4550}
4551
4553{
4554};
4555
4556
4558 mxImplRuler ( new PPTRuler() )
4559{
4560}
4561
4563{
4564 mxImplRuler = rRuler.mxImplRuler;
4565}
4566
4568 mxImplRuler ( new PPTRuler() )
4569{
4570 if ( nFileOfs == 0xffffffff )
4571 return;
4572
4573 sal_uInt32 nOldPos = rIn.Tell();
4574 DffRecordHeader rHd;
4575 if ( nFileOfs )
4576 {
4577 rIn.Seek( nFileOfs );
4578 ReadDffRecordHeader( rIn, rHd );
4579 }
4580 else
4581 {
4582 rHeader.SeekToContent( rIn );
4584 nFileOfs++;
4585 }
4586 if ( nFileOfs )
4587 {
4588 bool bRecordOk = true;
4589
4590 sal_Int16 nTCount(0);
4591 sal_Int32 i;
4592 rIn.ReadInt32( mxImplRuler->nFlags );
4593
4594 // number of indent levels, unused now
4595 if ( mxImplRuler->nFlags & 2 )
4596 rIn.ReadInt16( nTCount );
4597 if ( mxImplRuler->nFlags & 1 )
4598 rIn.ReadUInt16( mxImplRuler->nDefaultTab );
4599 if ( mxImplRuler->nFlags & 4 )
4600 {
4601 rIn.ReadInt16(nTCount);
4602
4603 const size_t nMaxPossibleRecords = rIn.remainingSize() / (2*sizeof(sal_uInt16));
4604 const sal_uInt16 nTabCount(nTCount);
4605
4606 bRecordOk = nTabCount <= nMaxPossibleRecords;
4607
4608 if (nTCount && bRecordOk)
4609 {
4610 mxImplRuler->nTabCount = nTabCount;
4611 mxImplRuler->pTab.reset( new PPTTabEntry[ mxImplRuler->nTabCount ] );
4612 for ( i = 0; i < nTCount; i++ )
4613 {
4614 rIn.ReadUInt16( mxImplRuler->pTab[ i ].nOffset )
4615 .ReadUInt16( mxImplRuler->pTab[ i ].nStyle );
4616 }
4617 }
4618 }
4619
4620 if (bRecordOk)
4621 {
4622 for ( i = 0; i < 5; i++ )
4623 {
4624 if ( mxImplRuler->nFlags & ( 8 << i ) )
4625 rIn.ReadUInt16( mxImplRuler->nTextOfs[ i ] );
4626 if ( mxImplRuler->nFlags & ( 256 << i ) )
4627 rIn.ReadUInt16( mxImplRuler->nBulletOfs[ i ] );
4628 if( mxImplRuler->nBulletOfs[ i ] > 0x7fff)
4629 {
4630 // workaround
4631 // when bullet offset is > 0x7fff, the paragraph should look like
4632 // * first line text
4633 // second line text
4634
4635 // we add to bullet para indent 0xffff - bullet offset. It looks like
4636 // best we can do for now
4637 mxImplRuler->nTextOfs[ i ] += 0xffff - mxImplRuler->nBulletOfs[ i ];
4638 mxImplRuler->nBulletOfs[ i ] = 0;
4639 }
4640 }
4641 }
4642 }
4643 rIn.Seek( nOldPos );
4644}
4645
4646bool PPTTextRulerInterpreter::GetDefaultTab( sal_uInt16& nValue ) const
4647{
4648 if ( ! ( mxImplRuler->nFlags & 1 ) )
4649 return false;
4650 nValue = mxImplRuler->nDefaultTab;
4651 return true;
4652}
4653
4654bool PPTTextRulerInterpreter::GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const
4655{
4656 if ( ! ( ( nLevel < 5 ) && ( mxImplRuler->nFlags & ( 8 << nLevel ) ) ) )
4657 return false;
4658 nValue = mxImplRuler->nTextOfs[ nLevel ];
4659 return true;
4660}
4661
4662bool PPTTextRulerInterpreter::GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const
4663{
4664 if ( ! ( ( nLevel < 5 ) && ( mxImplRuler->nFlags & ( 256 << nLevel ) ) ) )
4665 return false;
4666 nValue = mxImplRuler->nBulletOfs[ nLevel ];
4667 return true;
4668}
4669
4671{
4672 if ( this != &rRuler )
4673 {
4674 mxImplRuler = rRuler.mxImplRuler;
4675 }
4676 return *this;
4677}
4678
4680{
4681}
4682
4684 bValid ( false ),
4685 bForbiddenRules ( false ),
4686 bHangingPunctuation ( false ),
4687 bLatinTextWrap ( false )
4688{
4689}
4690
4692{
4693 bValid = false;
4694 rRecHd.SeekToContent( rIn );
4695 sal_uInt32 nDummy32, nFlags, nRecEndPos = rRecHd.GetRecEndFilePos();
4696 sal_uInt16 nDummy16;
4697
4698 rIn.ReadUInt16( nDummy16 )
4699 .ReadUInt32( nFlags );
4700
4701 if ( nFlags & 0xf && ( rIn.Tell() < nRecEndPos ) )
4702 rIn.ReadUInt16( nDummy16 ); // BuFlags
4703 if ( nFlags & 0x80 && ( rIn.Tell() < nRecEndPos ) )
4704 rIn.ReadUInt16( nDummy16 ); // BuChar
4705 if ( nFlags & 0x10 && ( rIn.Tell() < nRecEndPos ) )
4706 rIn.ReadUInt16( nDummy16 ); // nBuFont;
4707 if ( nFlags & 0x40 && ( rIn.Tell() < nRecEndPos ) )
4708 rIn.ReadUInt16( nDummy16 ); // nBuHeight;
4709 if ( nFlags & 0x0020 && ( rIn.Tell() < nRecEndPos ) )
4710 rIn.ReadUInt32( nDummy32 ); // nBuColor;
4711 if ( nFlags & 0x800 && ( rIn.Tell() < nRecEndPos ) )
4712 rIn.ReadUInt16( nDummy16 ); // AbsJust!
4713 if ( nFlags & 0x400 && ( rIn.Tell() < nRecEndPos ) )
4714 rIn.ReadUInt16( nDummy16 );
4715 if ( nFlags & 0x200 && ( rIn.Tell() < nRecEndPos ) )
4716 rIn.ReadUInt16( nDummy16 );
4717 if ( nFlags & 0x100 && ( rIn.Tell() < nRecEndPos ) )
4718 rIn.ReadUInt16( nDummy16 );
4719 if ( nFlags & 0x1000 && ( rIn.Tell() < nRecEndPos ) )
4720 rIn.ReadUInt16( nDummy16 ); // LineFeed
4721 if ( nFlags & 0x2000 && ( rIn.Tell() < nRecEndPos ) )
4722 rIn.ReadUInt16( nDummy16 ); // nUpperDist
4723 if ( nFlags & 0x4000 && ( rIn.Tell() < nRecEndPos ) )
4724 rIn.ReadUInt16( nDummy16 ); // nLowerDist
4725 if ( nFlags & 0x8000 && ( rIn.Tell() < nRecEndPos ) )
4726 rIn.ReadUInt16( nDummy16 );
4727 if ( nFlags & 0x10000 && ( rIn.Tell() < nRecEndPos ) )
4728 rIn.ReadUInt16( nDummy16 );
4729 if ( nFlags & 0xe0000 && ( rIn.Tell() < nRecEndPos ) )
4730 {
4731 rIn.ReadUInt16( nDummy16 );
4732 if ( nFlags & 0x20000 )
4733 bForbiddenRules = ( nDummy16 & 1 ) == 1;
4734 if ( nFlags & 0x40000 )
4735 bLatinTextWrap = ( nDummy16 & 2 ) == 0;
4736 if ( nFlags & 0x80000 )
4737 bHangingPunctuation = ( nDummy16 & 4 ) == 4;
4738 }
4739 nFlags &=~ 0xfffff;
4740 sal_uInt32 nMask = 0x100000;
4741 while ( nFlags && nMask && ( rIn.Tell() < nRecEndPos ) )
4742 {
4743 if ( nFlags & nMask )
4744 {
4745 rIn.ReadUInt16( nDummy16 );
4746 nFlags ^= nMask;
4747 }
4748 nMask <<= 1;
4749 }
4750 bValid = rIn.Tell() == nRecEndPos;
4751 return bValid;
4752}
4753
4754PPTTextSpecInfo::PPTTextSpecInfo( sal_uInt32 _nCharIdx ) :
4755 nCharIdx ( _nCharIdx ),
4756 nDontKnow ( 1 )
4757{
4761}
4762
4764 bValid ( false )
4765{
4766}
4767
4769 sal_uInt16 nRecordType, const PPTTextSpecInfo* pTextSpecDefault )
4770{
4771 bValid = false;
4772 sal_uInt32 nCharIdx = 0;
4773 rRecHd.SeekToContent( rIn );
4774
4775 auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, rRecHd.GetRecEndFilePos());
4776 while (rIn.Tell() < nEndRecPos && rIn.good())
4777 {
4778 if ( nRecordType == PPT_PST_TextSpecInfoAtom )
4779 {
4780 sal_uInt32 nCharCount(0);
4781 rIn.ReadUInt32( nCharCount );
4782 nCharIdx += nCharCount;
4783 }
4784
4785 sal_uInt32 nFlags(0);
4786 rIn.ReadUInt32(nFlags);
4787
4788 PPTTextSpecInfo aEntry( nCharIdx );
4789 if ( pTextSpecDefault )
4790 {
4791 aEntry.nDontKnow = pTextSpecDefault->nDontKnow;
4792 aEntry.nLanguage[ 0 ] = pTextSpecDefault->nLanguage[ 0 ];
4793 aEntry.nLanguage[ 1 ] = pTextSpecDefault->nLanguage[ 1 ];
4794 aEntry.nLanguage[ 2 ] = pTextSpecDefault->nLanguage[ 2 ];
4795 }
4796 for (sal_uInt32 i = 1; nFlags && i ; i <<= 1)
4797 {
4798 sal_uInt16 nLang = 0;
4799 switch( nFlags & i )
4800 {
4801 case 0 : break;
4802 case 1 : rIn.ReadUInt16( aEntry.nDontKnow ); break;
4803 case 2 : rIn.ReadUInt16( nLang ); break;
4804 case 4 : rIn.ReadUInt16( nLang ); break;
4805 default :
4806 {
4807 rIn.SeekRel( 2 );
4808 }
4809 }
4810 if ( nLang )
4811 {
4812 // #i119985#, we could probably handle this better if we have a
4813 // place to override the final language for weak
4814 // characters/fields to fallback to, rather than the current
4815 // application locale. Assuming that we can determine what the
4816 // default fallback language for a given .ppt, etc is during
4817 // load time.
4818 if (i == 2)
4819 {
4820 aEntry.nLanguage[ 0 ] = aEntry.nLanguage[ 1 ] = aEntry.nLanguage[ 2 ] = LanguageType(nLang);
4821 }
4822 }
4823 nFlags &= ~i;
4824 }
4825 aList.push_back( aEntry );
4826 }
4827 bValid = rIn.Tell() == rRecHd.GetRecEndFilePos();
4828 return bValid;
4829}
4830
4832{
4833}
4834
4836{
4838 if ( mnExtParagraphMask & 0x800000 )
4839 rIn.ReadUInt16( mnBuBlip );
4840 if ( mnExtParagraphMask & 0x2000000 )
4841 rIn.ReadUInt16( mnHasAnm );
4842 if ( mnExtParagraphMask & 0x1000000 )
4843 rIn.ReadUInt32( mnAnmScheme );
4844 if ( mnExtParagraphMask & 0x4000000 )
4845 rIn.ReadUInt32( mpfPP10Ext );
4847 if ( mnExtCharacterMask & 0x100000 )
4848 rIn.ReadUInt32( mncfPP10Ext );
4850 if ( mnSpecialInfoMask & 0x20 )
4851 rIn.ReadUInt32( mnPP10Ext );
4852 if ( mnSpecialInfoMask & 0x40 )
4853 rIn.ReadUInt16( mfBidi );
4854}
4855
4857 PPTTextRulerInterpreter const & rRuler, const DffRecordHeader& rExtParaHd, TSS_Type nInstance )
4858{
4859 Init(rIn, rTextHeader, rRuler, rExtParaHd, nInstance);
4860}
4861
4863 const OUString& aString, PPTTextRulerInterpreter const & rRuler,
4864 sal_uInt32& nCharCount, bool& bTextPropAtom )
4865{
4866 sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
4867 sal_uInt32 nCharReadCnt = 0;
4868 sal_uInt16 nDummy16;
4869
4870 sal_uInt16 nStringLen = aString.getLength();
4871
4872 DffRecordHeader aTextHd2;
4873 rTextHeader.SeekToContent( rIn );
4874 if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_StyleTextPropAtom, rTextHeader.GetRecEndFilePos(), &aTextHd2 ) )
4875 bTextPropAtom = true;
4876 while ( nCharReadCnt <= nStringLen )
4877 {
4878 PPTParaPropSet aParaPropSet;
4879 ImplPPTParaPropSet& aSet = *aParaPropSet.mxParaSet;
4880 if ( bTextPropAtom )
4881 {
4882 rIn.ReadUInt32( nCharCount )
4883 .ReadUInt16( aParaPropSet.mxParaSet->mnDepth ); // indent depth
4884
4885 aParaPropSet.mxParaSet->mnDepth = // taking care of about using not more than 9 outliner levels
4886 std::min(sal_uInt16(8),
4887 aParaPropSet.mxParaSet->mnDepth);
4888
4889 nCharCount--;
4890
4891 rIn.ReadUInt32( nMask );
4892 aSet.mnAttrSet = nMask & 0x207df7;
4893 sal_uInt16 nBulFlg = 0;
4894 if ( nMask & 0xF )
4895 rIn.ReadUInt16( nBulFlg ); // Bullet-HardAttr-Flags
4896 aSet.mpArry[ PPT_ParaAttr_BulletOn ] = ( nBulFlg & 1 ) ? 1 : 0;
4897 aSet.mpArry[ PPT_ParaAttr_BuHardFont ] = ( nBulFlg & 2 ) ? 1 : 0;
4898 aSet.mpArry[ PPT_ParaAttr_BuHardColor ] = ( nBulFlg & 4 ) ? 1 : 0;
4899
4900 // NOTE: one might think that the hard-coded numbers here are the
4901 // same as the PPT_ParaAttr_* constants, but it's NOT always true!
4902 if ( nMask & 0x0080 ) // buChar
4903 {
4905 if (!rIn.good())
4906 {
4907 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_BulletChar);
4908 }
4909 }
4910 if ( nMask & 0x0010 ) // buTypeface
4911 {
4913 if (!rIn.good())
4914 {
4915 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_BulletFont);
4916 }
4917 }
4918 if ( nMask & 0x0040 ) // buSize
4919 {
4921 if (!rIn.good()
4922 || !((nMask & (1 << PPT_ParaAttr_BuHardHeight))
4923 && (nBulFlg & (1 << PPT_ParaAttr_BuHardHeight))))
4924 {
4925 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_BulletHeight);
4926 }
4927 }
4928 if ( nMask & 0x0020 ) // buColor
4929 {
4930 sal_uInt32 nVal32;
4931 rIn.ReadUInt32( nVal32 );
4932 if (!rIn.good())
4933 {
4934 aSet.mnBulletColor = 0; // no flag for this? default it
4935 }
4936 else
4937 {
4938 sal_uInt32 nHiByte;
4939 nHiByte = nVal32 >> 24;
4940 if ( nHiByte <= 8 )
4941 nVal32 = nHiByte | PPT_COLSCHEME;
4942 aSet.mnBulletColor = nVal32;
4943 }
4944 }
4945 if ( nMask & 0x0800 ) // pfAlignment
4946 {
4947 rIn.ReadUInt16( nDummy16 );
4948 if (!rIn.good())
4949 {
4950 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_Adjust);
4951 }
4952 else
4953 {
4954 aSet.mpArry[ PPT_ParaAttr_Adjust ] = nDummy16 & 3;
4955 }
4956 }
4957 if ( nMask & 0x1000 ) // pfLineSpacing
4958 {
4960 if (!rIn.good())
4961 {
4962 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_LineFeed);
4963 }
4964 }
4965 if ( nMask & 0x2000 ) // pfSpaceBefore
4966 {
4968 if (!rIn.good())
4969 {
4970 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_UpperDist);
4971 }
4972 }
4973 if ( nMask & 0x4000 ) // pfSpaceAfter
4974 {
4976 if (!rIn.good())
4977 {
4978 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_LowerDist);
4979 }
4980 }
4981 if ( nMask & 0x100 ) // pfLeftMargin
4982 {
4983 rIn.ReadUInt16( aSet.mpArry[ PPT_ParaAttr_TextOfs ] );
4984 if (!rIn.good())
4985 {
4986 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_TextOfs);
4987 }
4988 else
4989 {
4990 aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs;
4991 }
4992 }
4993 if ( nMask & 0x400 ) // pfIndent
4994 {
4996 if (!rIn.good())
4997 {
4998 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_BulletOfs);
4999 }
5000 else
5001 {
5002 aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs;
5003 }
5004 }
5005 if ( nMask & 0x8000 ) // pfDefaultTabSize
5006 {
5007 rIn.ReadUInt16( nDummy16 );
5008 if (!rIn.good())
5009 {
5010 // TODO?
5011 }
5012 }
5013 if ( nMask & 0x100000 ) // pfTabStops
5014 {
5015 sal_uInt16 i, nDistance, nAlignment, nNumberOfTabStops = 0;
5016 rIn.ReadUInt16( nNumberOfTabStops );
5017 if (!rIn.good())
5018 {
5019 // TODO?
5020 }
5021 else
5022 {
5023 const size_t nMinRecordSize = 4;
5024 const size_t nMaxRecords = rIn.remainingSize() / nMinRecordSize;
5025 if (nNumberOfTabStops > nMaxRecords)
5026 {
5027 SAL_WARN("filter.ms", "Parsing error: " << nMaxRecords <<
5028 " max possible entries, but " << nNumberOfTabStops << " claimed, truncating");
5029 nNumberOfTabStops = nMaxRecords;
5030 }
5031 for (i = 0; i < nNumberOfTabStops; ++i)
5032 {
5033 rIn.ReadUInt16( nDistance )
5034 .ReadUInt16( nAlignment );
5035 }
5036 }
5037 }
5038 if ( nMask & 0x10000 ) // pfBaseLine
5039 {
5040 rIn.ReadUInt16( nDummy16 );
5041 if (!rIn.good())
5042 {
5043 // TODO?
5044 }
5045 }
5046 if ( nMask & 0xe0000 ) // pfCharWrap, pfWordWrap, pfOverflow
5047 {
5048 rIn.ReadUInt16( nDummy16 );
5049 if (!rIn.good())
5050 { // clear flag to avoid invalid access
5051 aSet.mnAttrSet &= ~((1 << PPT_ParaAttr_AsianLB_1)
5052 | (1 << PPT_ParaAttr_AsianLB_2)
5053 | (1 << PPT_ParaAttr_AsianLB_3));
5054 }
5055 else
5056 {
5057 if (nMask & 0x20000)
5058 aSet.mpArry[PPT_ParaAttr_AsianLB_1] = nDummy16 & 1;
5059 if (nMask & 0x40000)
5060 aSet.mpArry[PPT_ParaAttr_AsianLB_2] = (nDummy16 >> 1) & 1;
5061 if (nMask & 0x80000)
5062 aSet.mpArry[PPT_ParaAttr_AsianLB_3] = (nDummy16 >> 2) & 1;
5063 aSet.mnAttrSet |= ((nMask >> 17) & 7) << PPT_ParaAttr_AsianLB_1;
5064 }
5065 }
5066 if ( nMask & 0x200000 ) // pfTextDirection
5067 {
5068 rIn.ReadUInt16( aSet.mpArry[ PPT_ParaAttr_BiDi ] );
5069 if (!rIn.good())
5070 { // clear flag to avoid invalid access
5071 aSet.mnAttrSet &= ~(1 << PPT_ParaAttr_BiDi);
5072 }
5073 }
5074 }
5075 else
5076 nCharCount = nStringLen;
5077
5078 //if the textofs attr has been read at above, need not to reset.
5079 if ( ( !( aSet.mnAttrSet & 1 << PPT_ParaAttr_TextOfs ) ) && rRuler.GetTextOfs( aParaPropSet.mxParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_TextOfs ] ) )
5080 aSet.mnAttrSet |= 1 << PPT_ParaAttr_TextOfs;
5081 if ( ( !( aSet.mnAttrSet & 1 << PPT_ParaAttr_BulletOfs ) ) && rRuler.GetBulletOfs( aParaPropSet.mxParaSet->mnDepth, aSet.mpArry[ PPT_ParaAttr_BulletOfs ] ) )
5082 aSet.mnAttrSet |= 1 << PPT_ParaAttr_BulletOfs;
5083 if ( rRuler.GetDefaultTab( aSet.mpArry[ PPT_ParaAttr_DefaultTab ] ) )
5085
5086 if ( ( nCharCount > nStringLen ) || ( nStringLen < nCharReadCnt + nCharCount ) )
5087 {
5088 bTextPropAtom = false;
5089 nCharCount = nStringLen - nCharReadCnt;
5090 // please fix the right hand side of
5091 // PPTParaPropSet& PPTParaPropSet::operator=(PPTParaPropSet&),
5092 // it should be a const reference
5093 PPTParaPropSet aTmpPPTParaPropSet;
5094 aParaPropSet = aTmpPPTParaPropSet;
5095 OSL_FAIL( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" );
5096 }
5097 PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet );
5098 pPara->mnOriginalTextPos = nCharReadCnt;
5099 aParaPropList.emplace_back( pPara );
5100 if ( nCharCount )
5101 {
5102 sal_uInt32 nCount;
5103 const sal_Unicode* pDat = aString.getStr() + nCharReadCnt;
5104 for ( nCount = 0; nCount < nCharCount; nCount++ )
5105 {
5106 if ( pDat[ nCount ] == 0xd )
5107 {
5108 pPara = new PPTParaPropSet( aParaPropSet );
5109 pPara->mnOriginalTextPos = nCharReadCnt + nCount + 1;
5110 aParaPropList.emplace_back( pPara );
5111 }
5112 }
5113 }
5114 nCharReadCnt += nCharCount + 1;
5115 }
5116}
5117
5118void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, std::u16string_view aString,
5119 sal_uInt32& nCharCount, sal_uInt32 nCharReadCnt,
5120 bool& bTextPropAtom, sal_uInt32 nExtParaPos,
5121 const std::vector< StyleTextProp9 >& aStyleTextProp9,
5122 sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
5123 sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme )
5124{
5125 sal_uInt16 nStringLen = aString.size();
5126
5127 sal_uInt16 nDummy16;
5128 rIn.ReadUInt16( nDummy16 );
5129 nCharCount = (rIn.good()) ? nDummy16 : 0;
5130 rIn.ReadUInt16( nDummy16 );
5131
5132 sal_Int32 nCharsToRead = nStringLen - ( nCharReadCnt + nCharCount );
5133 if ( nCharsToRead < 0 )
5134 {
5135 nCharCount = nStringLen - nCharReadCnt;
5136 if ( nCharsToRead < -1 )
5137 {
5138 bTextPropAtom = false;
5139 OSL_FAIL( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" );
5140 }
5141 }
5142 ImplPPTCharPropSet& aSet = *aCharPropSet.mpImplPPTCharPropSet;
5143
5144 // character attributes
5145 sal_uInt32 nMask(0);
5146 rIn.ReadUInt32( nMask );
5147 if ( static_cast<sal_uInt16>(nMask) )
5148 {
5149 aSet.mnAttrSet |= static_cast<sal_uInt16>(nMask);
5150 rIn.ReadUInt16( aSet.mnFlags );
5151 }
5152 if ( nMask & 0x10000 ) // cfTypeface
5153 {
5154 rIn.ReadUInt16( aSet.mnFont );
5155 aSet.mnAttrSet |= 1 << PPT_CharAttr_Font;
5156 }
5157 if ( nMask & 0x200000 ) // cfFEOldTypeface
5158 {
5159 rIn.ReadUInt16( aSet.mnAsianOrComplexFont );
5161 }
5162 if ( nMask & 0x400000 ) // cfANSITypeface
5163 {
5164 rIn.ReadUInt16( aSet.mnANSITypeface );
5166 }
5167 if ( nMask & 0x800000 ) // cfSymbolTypeface
5168 {
5169 rIn.ReadUInt16( aSet.mnSymbolFont );
5170 aSet.mnAttrSet |= 1 << PPT_CharAttr_Symbol;
5171 }
5172 if ( nMask & 0x20000 ) // cfSize
5173 {
5174 rIn.ReadUInt16( aSet.mnFontHeight );
5176 }
5177 if ( nMask & 0x40000 ) // cfColor
5178 {
5179 sal_uInt32 nVal(0);
5180 rIn.ReadUInt32( nVal );
5181 if ( !( nVal & 0xff000000 ) )
5183 aSet.mnColor = nVal;
5184 aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor;
5185 }
5186 if ( nMask & 0x80000 ) // cfPosition
5187 {
5188 rIn.ReadUInt16( aSet.mnEscapement );
5190 }
5191 if ( !nExtParaPos )
5192 return;
5193
5194 sal_uInt32 nExtBuInd = nMask & 0x3c00;
5195 if ( nExtBuInd )
5196 nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10;
5197 if ( nExtBuInd < aStyleTextProp9.size() )
5198 {
5199 nExtParaFlags = aStyleTextProp9[ nExtBuInd ].mnExtParagraphMask;
5200 nBuBlip = aStyleTextProp9[ nExtBuInd ].mnBuBlip;
5201 nHasAnm = aStyleTextProp9[ nExtBuInd ].mnHasAnm;
5202 nAnmScheme = aStyleTextProp9[ nExtBuInd ].mnAnmScheme;
5203 }
5204}
5205
5207 PPTTextRulerInterpreter const & rRuler, const DffRecordHeader& rExtParaHd, TSS_Type nInstance )
5208{
5209 sal_uInt32 nOldPos = rIn.Tell();
5210 sal_uInt32 nExtParaPos = ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom ) ? rExtParaHd.nFilePos + 8 : 0;
5211
5212 std::vector< StyleTextProp9 > aStyleTextProp9;
5213 if ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom )
5214 {
5215 rIn.Seek( rExtParaHd.nFilePos + 8 );
5216
5217 auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, rExtParaHd.GetRecEndFilePos());
5218 while( ( rIn.GetError() == ERRCODE_NONE ) && ( rIn.Tell() < nEndRecPos ) )
5219 {
5220 aStyleTextProp9.emplace_back();
5221 aStyleTextProp9.back().Read( rIn );
5222 }
5223 rIn.Seek( nOldPos );
5224 }
5225
5226 OUString aString;
5227 DffRecordHeader aTextHd;
5228 ReadDffRecordHeader( rIn, aTextHd );
5229 sal_uInt32 nMaxLen = aTextHd.nRecLen;
5230 if ( nMaxLen >= 0xFFFF )
5231 nMaxLen = 0xFFFE;
5232
5233 if( aTextHd.nRecType == PPT_PST_TextCharsAtom )
5234 {
5235 std::vector<sal_Unicode> aBuf(( nMaxLen >> 1 ) + 1);
5236 void* pDest = aBuf.data();
5237 auto nRead = rIn.ReadBytes(pDest, nMaxLen);
5238 if (nRead != nMaxLen)
5239 memset(static_cast<char*>(pDest) + nRead, 0, nMaxLen - nRead);
5240 nMaxLen >>= 1;
5241 aBuf[nMaxLen] = 0;
5242
5243 sal_uInt32 i;
5244 sal_Unicode* pPtr = aBuf.data();
5245
5246#ifdef OSL_BIGENDIAN
5247 sal_Unicode nTemp;
5248 for ( i = 0; i < nMaxLen; i++ )
5249 {
5250 nTemp = *pPtr;
5251 *pPtr++ = ( nTemp << 8 ) | ( nTemp >> 8 );
5252 }
5253 pPtr = aBuf.data();
5254#endif
5255
5256 for ( i = 0; i < nMaxLen; pPtr++, i++ )
5257 {
5258 sal_Unicode nChar = *pPtr;
5259 if ( !nChar )
5260 break;
5261 if ( ( nChar & 0xff00 ) == 0xf000 ) // in this special case we got a symbol
5262 aSpecMarkerList.push_back( static_cast<sal_uInt32>( i | PPT_SPEC_SYMBOL ) );
5263 else if ( nChar == 0xd )
5264 {
5265 if ( nInstance == TSS_Type::PageTitle )
5266 *pPtr = 0xb;
5267 else
5268 aSpecMarkerList.push_back( static_cast<sal_uInt32>( i | PPT_SPEC_NEWLINE ) );
5269 }
5270 }
5271 if ( i )
5272 aString = OUString(aBuf.data(), i);
5273 }
5274 else if( aTextHd.nRecType == PPT_PST_TextBytesAtom )
5275 {
5276 std::unique_ptr<char[]> pBuf(new char[ nMaxLen + 1 ]);
5277 nMaxLen = rIn.ReadBytes(pBuf.get(), nMaxLen);
5278 pBuf[ nMaxLen ] = 0;
5279 char* pPtr = pBuf.get();
5280 for (;;)
5281 {
5282 char cLo = *pPtr;
5283 if ( cLo == 0 )
5284 break;
5285 if ( cLo == 0xd )
5286 {
5287 if ( nInstance == TSS_Type::PageTitle )
5288 *pPtr = 0xb;
5289 else
5290 aSpecMarkerList.push_back( static_cast<sal_uInt32>( (pPtr - pBuf.get()) | PPT_SPEC_NEWLINE ) );
5291 }
5292 pPtr++;
5293 }
5294 sal_Int32 nLen = pPtr - pBuf.get();
5295 if ( nLen )
5296 aString = OUString( pBuf.get(), nLen, RTL_TEXTENCODING_MS_1252 );
5297 }
5298 else
5299 {
5300 // no chars, but potentially char/para props?
5301 sal_uInt32 nCharCount;
5302 bool bTextPropAtom = false;
5303 ReadParaProps( rIn, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
5304
5305 if ( bTextPropAtom )
5306 {
5307 // yeah, StyleTextProp is there, read it all & push to
5308 // aParaPropList
5309 PPTCharPropSet aCharPropSet(0);
5310 aCharPropSet.mnOriginalTextPos = 0;
5311
5312 sal_uInt32 nExtParaFlags = 0, nAnmScheme = 0;
5313 sal_uInt16 nBuBlip = 0xffff, nHasAnm = 0;
5314 ReadCharProps( rIn, aCharPropSet, aString, nCharCount, 0/*nCharReadCnt*/,
5315 bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
5316 nBuBlip, nHasAnm, nAnmScheme );
5317
5318 aCharPropList.push_back(std::make_unique<PPTCharPropSet>(aCharPropSet, 0));
5319 }
5320 }
5321
5322 if ( !aString.isEmpty() )
5323 {
5324 sal_uInt32 nCharCount;
5325 bool bTextPropAtom = false;
5326
5327 ReadParaProps( rIn, rTextHeader, aString, rRuler, nCharCount, bTextPropAtom );
5328
5329 bool bEmptyParaPossible = true;
5330 sal_uInt32 nCharReadCnt = 0;
5331 sal_uInt32 nCurrentPara = 0;
5332 size_t i = 1; // points to the next element to process
5333 sal_uInt32 nCurrentSpecMarker = aSpecMarkerList.empty() ? 0 : aSpecMarkerList[0];
5334 sal_uInt32 nStringLen = aString.getLength();
5335
5336 while ( nCharReadCnt < nStringLen )
5337 {
5338 sal_uInt32 nExtParaFlags = 0, nLatestParaUpdate = 0xffffffff, nAnmScheme = 0;
5339 sal_uInt16 nBuBlip = 0xffff, nHasAnm = 0;
5340
5341 PPTCharPropSet aCharPropSet( nCurrentPara );
5342 if ( bTextPropAtom )
5343 {
5344 ReadCharProps( rIn, aCharPropSet, aString, nCharCount, nCharReadCnt,
5345 bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
5346 nBuBlip, nHasAnm, nAnmScheme );
5347 if (!rIn.good())
5348 break;
5349 }
5350 else
5351 nCharCount = nStringLen;
5352
5353 sal_uInt32 nLen;
5354 while( nCharCount )
5355 {
5356 if ( nExtParaPos && ( nLatestParaUpdate != nCurrentPara ) && ( nCurrentPara < aParaPropList.size() ) )
5357 {
5358 PPTParaPropSet* pPropSet = aParaPropList[ nCurrentPara ].get();
5359 pPropSet->mxParaSet->mnExtParagraphMask = nExtParaFlags;
5360 if ( nExtParaFlags & 0x800000 )
5361 pPropSet->mxParaSet->mnBuBlip = nBuBlip;
5362 if ( nExtParaFlags & 0x01000000 )
5363 pPropSet->mxParaSet->mnAnmScheme = nAnmScheme;
5364 if ( nExtParaFlags & 0x02000000 )
5365 pPropSet->mxParaSet->mnHasAnm = nHasAnm;
5366 nLatestParaUpdate = nCurrentPara;
5367 }
5368 aCharPropSet.mnOriginalTextPos = nCharReadCnt;
5369 if ( nCurrentSpecMarker && ( ( nCurrentSpecMarker & 0xffff ) < ( nCharReadCnt + nCharCount ) ) )
5370 {
5371 if ( nCurrentSpecMarker & PPT_SPEC_NEWLINE )
5372 {
5373 nLen = ( nCurrentSpecMarker & 0xffff ) - nCharReadCnt;
5374 if ( nLen )
5375 aCharPropSet.maString = aString.copy( nCharReadCnt, nLen );
5376 else if ( bEmptyParaPossible )
5377 aCharPropSet.maString.clear();
5378 if ( nLen || bEmptyParaPossible )
5379 aCharPropList.push_back(
5380 std::make_unique<PPTCharPropSet>(aCharPropSet, nCurrentPara));
5381 nCurrentPara++;
5382 nLen++;
5383 nCharReadCnt += nLen;
5384 nCharCount -= nLen;
5385 bEmptyParaPossible = true;
5386 }
5387 else if ( nCurrentSpecMarker & PPT_SPEC_SYMBOL )
5388 {
5389 if ( ( nCurrentSpecMarker & 0xffff ) != nCharReadCnt )
5390 {
5391 nLen = ( nCurrentSpecMarker & 0xffff ) - nCharReadCnt;
5392 aCharPropSet.maString = aString.copy(nCharReadCnt, nLen);
5393 aCharPropList.push_back(
5394 std::make_unique<PPTCharPropSet>(aCharPropSet, nCurrentPara));
5395 nCharCount -= nLen;
5396 nCharReadCnt += nLen;
5397 }
5398 PPTCharPropSet* pCPropSet = new PPTCharPropSet( aCharPropSet, nCurrentPara );
5399 pCPropSet->maString = aString.copy(nCharReadCnt, 1);
5400 if ( aCharPropSet.mpImplPPTCharPropSet->mnAttrSet & ( 1 << PPT_CharAttr_Symbol ) )
5401 pCPropSet->SetFont( aCharPropSet.mpImplPPTCharPropSet->mnSymbolFont );
5402 aCharPropList.emplace_back( pCPropSet );
5403 nCharCount--;
5404 nCharReadCnt++;
5405 bEmptyParaPossible = false;
5406 }
5407 nCurrentSpecMarker = ( i < aSpecMarkerList.size() ) ? aSpecMarkerList[ i++ ] : 0;
5408 }
5409 else
5410 {
5411 if (nCharReadCnt > o3tl::make_unsigned(aString.getLength()))
5412 aCharPropSet.maString = OUString();
5413 else
5414 {
5415 sal_Int32 nStrLen = nCharCount;
5416 sal_Int32 nMaxStrLen = aString.getLength() - nCharReadCnt;
5417 if (nStrLen > nMaxStrLen)
5418 nStrLen = nMaxStrLen;
5419 aCharPropSet.maString = aString.copy(nCharReadCnt, nStrLen);
5420 }
5421 aCharPropList.push_back(
5422 std::make_unique<PPTCharPropSet>(aCharPropSet, nCurrentPara));
5423 nCharReadCnt += nCharCount;
5424 bEmptyParaPossible = false;
5425 break;
5426 }
5427 }
5428 }
5429 if ( !aCharPropList.empty() && ( aCharPropList.back()->mnParagraph != nCurrentPara ) )
5430 {
5431 PPTCharPropSet* pCharPropSet = new PPTCharPropSet( *aCharPropList.back(), nCurrentPara );
5432 pCharPropSet->maString.clear();
5433 pCharPropSet->mnOriginalTextPos = nStringLen - 1;
5434 aCharPropList.emplace_back( pCharPropSet );
5435 }
5436 }
5437 rIn.Seek( nOldPos );
5438}
5439
5441{
5442}
5443
5444PPTPortionObj::PPTPortionObj( const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt32 nDepth ) :
5445 PPTCharPropSet ( 0 ),
5446 mrStyleSheet ( rStyleSheet ),
5447 mnInstance ( nInstance ),
5448 mnDepth ( std::min<sal_uInt32>( nDepth, 4 ) )
5449{
5450}
5451
5452PPTPortionObj::PPTPortionObj( const PPTCharPropSet& rCharPropSet, const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt32 nDepth ) :
5453 PPTCharPropSet ( rCharPropSet ),
5454 mrStyleSheet ( rStyleSheet ),
5455 mnInstance ( nInstance ),
5456 mnDepth ( std::min<sal_uInt32>( nDepth, 4 ) )
5457{
5458}
5459
5461 PPTCharPropSet ( rPortionObj ),
5462 mrStyleSheet ( rPortionObj.mrStyleSheet ),
5463 mnInstance ( rPortionObj.mnInstance ),
5464 mnDepth ( rPortionObj.mnDepth )
5465{
5466}
5467
5469{
5470}
5471
5472bool PPTPortionObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Type nDestinationInstance ) const
5473{
5474 sal_uInt32 nMask = 1 << nAttr;
5475 rRetValue = 0;
5476
5477 bool bIsHardAttribute = ( ( mpImplPPTCharPropSet->mnAttrSet & nMask ) != 0 );
5478
5479 if ( bIsHardAttribute )
5480 {
5481 switch ( nAttr )
5482 {
5483 case PPT_CharAttr_Bold :
5484 case PPT_CharAttr_Italic :
5486 case PPT_CharAttr_Shadow :
5489 rRetValue = ( mpImplPPTCharPropSet->mnFlags & nMask ) ? 1 : 0;
5490 break;
5491 case PPT_CharAttr_Font :
5492 rRetValue = mpImplPPTCharPropSet->mnFont;
5493 break;
5495 rRetValue = mpImplPPTCharPropSet->mnAsianOrComplexFont;
5496 break;
5498 rRetValue = mpImplPPTCharPropSet->mnFontHeight;
5499 break;
5501 rRetValue = mpImplPPTCharPropSet->mnColor;
5502 break;
5504 rRetValue = mpImplPPTCharPropSet->mnEscapement;
5505 break;
5506 default :
5507 OSL_FAIL( "SJ:PPTPortionObj::GetAttrib ( hard attribute does not exist )" );
5508 }
5509 }
5510 else
5511 {
5512 const PPTCharLevel& rCharLevel = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ];
5513 PPTCharLevel* pCharLevel = nullptr;
5514 if ( ( nDestinationInstance == TSS_Type::Unknown )
5516 bIsHardAttribute = true;
5517 else if ( nDestinationInstance != mnInstance )
5518 pCharLevel = &mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ mnDepth ];
5519 switch( nAttr )
5520 {
5521 case PPT_CharAttr_Bold :
5522 case PPT_CharAttr_Italic :
5524 case PPT_CharAttr_Shadow :
5527 {
5528 rRetValue = ( rCharLevel.mnFlags & nMask ) ? 1 : 0;
5529 if ( pCharLevel )
5530 {
5531 sal_uInt32 nTmp = ( pCharLevel->mnFlags & nMask ) ? 1 : 0;
5532 if ( rRetValue != nTmp )
5533 bIsHardAttribute = true;
5534 }
5535 }
5536 break;
5537 case PPT_CharAttr_Font :
5538 {
5539 rRetValue = rCharLevel.mnFont;
5540 if ( pCharLevel && ( rRetValue != pCharLevel->mnFont ) )
5541 bIsHardAttribute = true;
5542 }
5543 break;
5545 {
5546 rRetValue = rCharLevel.mnAsianOrComplexFont;
5547 if ( pCharLevel && ( rRetValue != pCharLevel->mnAsianOrComplexFont ) )
5548 bIsHardAttribute = true;
5549 }
5550 break;
5552 {
5553 rRetValue = rCharLevel.mnFontHeight;
5554 if ( pCharLevel && ( rRetValue != pCharLevel->mnFontHeight ) )
5555 bIsHardAttribute = true;
5556 }
5557 break;
5559 {
5560 rRetValue = rCharLevel.mnFontColor;
5561 if ( pCharLevel && ( rRetValue != pCharLevel->mnFontColor ) )
5562 bIsHardAttribute = true;
5563 }
5564 break;
5566 {
5567 rRetValue = rCharLevel.mnEscapement;
5568 if ( pCharLevel && ( rRetValue != pCharLevel->mnEscapement ) )
5569 bIsHardAttribute = true;
5570 }
5571 break;
5572 default :
5573 OSL_FAIL( "SJ:PPTPortionObj::GetAttrib ( attribute does not exist )" );
5574 }
5575 }
5576 return bIsHardAttribute;
5577}
5578
5579void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, TSS_Type nDestinationInstance )
5580{
5581 ApplyTo( rSet, rManager, nDestinationInstance, nullptr );
5582}
5583
5584void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, TSS_Type nDestinationInstance, const PPTTextObj* pTextObj )
5585{
5586 sal_uInt32 nVal;
5587 if ( GetAttrib( PPT_CharAttr_Bold, nVal, nDestinationInstance ) )
5588 {
5592 }
5593 if ( GetAttrib( PPT_CharAttr_Italic, nVal, nDestinationInstance ) )
5594 {
5598 }
5599 if ( GetAttrib( PPT_CharAttr_Underline, nVal, nDestinationInstance ) )
5601
5602 if ( GetAttrib( PPT_CharAttr_Shadow, nVal, nDestinationInstance ) )
5603 rSet.Put( SvxShadowedItem( nVal != 0, EE_CHAR_SHADOW ) );
5604
5605 if ( GetAttrib( PPT_CharAttr_Strikeout, nVal, nDestinationInstance ) )
5607
5608 sal_uInt32 nAsianFontId = 0xffff;
5609 if ( GetAttrib( PPT_CharAttr_AsianOrComplexFont, nAsianFontId, nDestinationInstance ) )
5610 {
5611 if ( nAsianFontId != 0xffff )
5612 {
5613 const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nAsianFontId );
5614 if ( pFontEnityAtom )
5615 {
5616 rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName,
5617 OUString(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO_CJK ) );
5618 rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName,
5619 OUString(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO_CTL ) );
5620 }
5621 }
5622 }
5623 if ( GetAttrib( PPT_CharAttr_Font, nVal, nDestinationInstance ) )
5624 {
5625 const PptFontEntityAtom* pFontEnityAtom = rManager.GetFontEnityAtom( nVal );
5626 if ( pFontEnityAtom )
5627 {
5628 rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName, OUString(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO ) );
5629
5630 // #i119475# bullet font info for CJK and CTL
5631 if ( RTL_TEXTENCODING_SYMBOL == pFontEnityAtom->eCharSet )
5632 {
5633 rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName, OUString(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO_CJK ) );
5634 rSet.Put( SvxFontItem( pFontEnityAtom->eFamily, pFontEnityAtom->aName, OUString(), pFontEnityAtom->ePitch, pFontEnityAtom->eCharSet, EE_CHAR_FONTINFO_CTL ) );
5635 }
5636 }
5637 }
5638 if ( GetAttrib( PPT_CharAttr_FontHeight, nVal, nDestinationInstance ) ) // Schriftgrad in Point
5639 {
5640 sal_uInt32 nHeight = rManager.ScalePoint( nVal );
5641 rSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
5644 }
5645
5646 if ( GetAttrib( PPT_CharAttr_Embossed, nVal, nDestinationInstance ) )
5647 rSet.Put( SvxCharReliefItem( nVal != 0 ? FontRelief::Embossed : FontRelief::NONE, EE_CHAR_RELIEF ) );
5648 if ( nVal ) /* if Embossed is set, the font color depends to the fillstyle/color of the object,
5649 if the object has no fillstyle, the font color depends to fillstyle of the background */
5650 {
5651 Color aDefColor( COL_BLACK );
5652 sal_uInt32 eFillType = mso_fillSolid;
5653 if ( rManager.GetPropertyValue( DFF_Prop_fNoFillHitTest, 0 ) & 0x10 )
5654 eFillType = rManager.GetPropertyValue(DFF_Prop_fillType, mso_fillSolid);
5655 else
5656 eFillType = mso_fillBackground;
5657 switch( eFillType )
5658 {
5659 case mso_fillShade :
5660 case mso_fillShadeCenter :
5661 case mso_fillShadeShape :
5662 case mso_fillShadeScale :
5663 case mso_fillShadeTitle :
5664 case mso_fillSolid :
5665 aDefColor = rManager.MSO_CLR_ToColor( rManager.GetPropertyValue( DFF_Prop_fillColor, 0 ) );
5666 break;
5667 case mso_fillPattern :
5668 aDefColor = rManager.MSO_CLR_ToColor( rManager.GetPropertyValue( DFF_Prop_fillBackColor, 0 ) );
5669 break;
5670 case mso_fillTexture :
5671 {
5672 Graphic aGraf;
5673 if ( rManager.GetBLIP( rManager.GetPropertyValue( DFF_Prop_fillBlip, 0 ), aGraf ) )
5674 {
5675 Bitmap aBmp( aGraf.GetBitmapEx().GetBitmap() );
5676 Size aSize( aBmp.GetSizePixel() );
5677 if ( aSize.Width() && aSize.Height() )
5678 {
5679 if ( aSize.Width () > 64 )
5680 aSize.setWidth( 64 );
5681 if ( aSize.Height() > 64 )
5682 aSize.setHeight( 64 );
5683
5684 Bitmap::ScopedReadAccess pAcc(aBmp);
5685 if( pAcc )
5686 {
5687 sal_uLong nRt = 0, nGn = 0, nBl = 0;
5688 const tools::Long nWidth = aSize.Width();
5689 const tools::Long nHeight = aSize.Height();
5690
5691 if( pAcc->HasPalette() )
5692 {
5693 for( tools::Long nY = 0; nY < nHeight; nY++ )
5694 {
5695 Scanline pScanline = pAcc->GetScanline( nY );
5696 for( tools::Long nX = 0; nX < nWidth; nX++ )
5697 {
5698 const BitmapColor& rCol = pAcc->GetPaletteColor( pAcc->GetIndexFromData( pScanline, nX ) );
5699 nRt+=rCol.GetRed(); nGn+=rCol.GetGreen(); nBl+=rCol.GetBlue();
5700 }
5701 }
5702 }
5703 else
5704 {
5705 for( tools::Long nY = 0; nY < nHeight; nY++ )
5706 {
5707 Scanline pScanline = pAcc->GetScanline( nY );
5708 for( tools::Long nX = 0; nX < nWidth; nX++ )
5709 {
5710 const BitmapColor aCol( pAcc->GetPixelFromData( pScanline, nX ) );
5711 nRt+=aCol.GetRed(); nGn+=aCol.GetGreen(); nBl+=aCol.GetBlue();
5712 }
5713 }
5714 }
5715 pAcc.reset();
5716 sal_uInt32 nC = aSize.Width() * aSize.Height();
5717 nRt /= nC;
5718 nGn /= nC;
5719 nBl /= nC;
5720 aDefColor = Color(sal_uInt8( nRt ), sal_uInt8( nGn ),sal_uInt8( nBl ) );
5721 }
5722 }
5723 }
5724 }
5725 break;
5726 case mso_fillBackground :
5727 {
5728 if ( pTextObj ) // the textobject is needed
5729 {
5730 const SfxItemSet* pItemSet = pTextObj->GetBackground();
5731 if ( pItemSet )
5732 {
5733 const XFillStyleItem* pFillStyleItem = pItemSet->GetItemIfSet( XATTR_FILLSTYLE, false );
5734 if ( pFillStyleItem )
5735 {
5736 drawing::FillStyle eFillStyle = pFillStyleItem->GetValue();
5737 switch( eFillStyle )
5738 {
5739 case drawing::FillStyle_SOLID :
5740 {
5741 const XColorItem* pFillColorItem = pItemSet->GetItemIfSet( XATTR_FILLCOLOR, false );
5742 if ( pFillColorItem )
5743 aDefColor = pFillColorItem->GetColorValue();
5744 }
5745 break;
5746 case drawing::FillStyle_GRADIENT :
5747 {
5748 const XFillGradientItem* pGradientItem = pItemSet->GetItemIfSet( XATTR_FILLGRADIENT, false );
5749 if ( pGradientItem )
5750 aDefColor = Color(pGradientItem->GetGradientValue().GetColorStops().front().getStopColor());
5751 }
5752 break;
5753 case drawing::FillStyle_HATCH :
5754 case drawing::FillStyle_BITMAP :
5755 aDefColor = COL_WHITE;
5756 break;
5757 default: break;
5758 }
5759 }
5760 }
5761 }
5762 }
5763 break;
5764 default: break;
5765 }
5766 rSet.Put( SvxColorItem( aDefColor, EE_CHAR_COLOR ) );
5767 }
5768 else
5769 {
5770 if ( GetAttrib( PPT_CharAttr_FontColor, nVal, nDestinationInstance ) ) // text color (4Byte-Arg)
5771 {
5772 Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) );
5773 rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) );
5774 if ( nDestinationInstance == TSS_Type::Unknown )
5775 mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet = aCol;
5776 }
5777 else if ( nVal & 0x0f000000 ) // this is not a hard attribute, but maybe the page has a different colorscheme,
5778 { // so that in this case we must use a hard color attribute
5779 Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) );
5780 Color& aColorInSheet = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet;
5781 if ( aColorInSheet != aCol )
5782 rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) );
5783 }
5784 }
5785
5786 if ( GetAttrib( PPT_CharAttr_Escapement, nVal, nDestinationInstance ) ) // super-/subscript in %
5787 {
5788 sal_uInt16 nEsc = 0;
5789 sal_uInt8 nProp = 100;
5790
5791 if ( nVal )
5792 {
5793 nEsc = static_cast<sal_Int16>(nVal);
5794 nProp = DFLT_ESC_PROP;
5795 }
5796 SvxEscapementItem aItem( nEsc, nProp, EE_CHAR_ESCAPEMENT );
5797 rSet.Put( aItem );
5798 }
5799 if ( mnLanguage[ 0 ] )
5801 if ( mnLanguage[ 1 ] )
5803 if ( mnLanguage[ 2 ] )
5805}
5806
5808{
5809 if ( mpFieldItem )
5810 return new SvxFieldItem( *mpFieldItem );
5811 return nullptr;
5812}
5813
5814namespace
5815{
5816 sal_uInt16 sanitizeForMaxPPTLevels(sal_uInt16 nDepth)
5817 {
5818 if (nDepth >= nMaxPPTLevels)
5819 {
5820 SAL_WARN("filter.ms", "Para Style Sheet depth " << nDepth << " but " << nMaxPPTLevels - 1 << " is max possible");
5821 nDepth = nMaxPPTLevels - 1;
5822 }
5823 return nDepth;
5824 }
5825}
5826
5827PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt16 nDepth ) :
5828 PPTNumberFormatCreator ( nullptr ),
5829 mrStyleSheet ( rStyleSheet ),
5830 mnInstance ( nInstance ),
5831 mnCurrentObject ( 0 )
5832{
5833 mxParaSet->mnDepth = sanitizeForMaxPPTLevels(nDepth);
5834}
5835
5837 size_t const nCurParaPos, size_t& rnCurCharPos,
5838 const PPTStyleSheet& rStyleSheet,
5839 TSS_Type nInstance, PPTTextRulerInterpreter const & rRuler ) :
5840 PPTParaPropSet ( *rPropReader.aParaPropList[nCurParaPos] ),
5841 PPTNumberFormatCreator ( nullptr ),
5842 PPTTextRulerInterpreter ( rRuler ),
5843 mrStyleSheet ( rStyleSheet ),
5844 mnInstance ( nInstance ),
5845 mnCurrentObject ( 0 )
5846{
5847 if (rnCurCharPos >= rPropReader.aCharPropList.size())
5848 return;
5849
5850 sal_uInt32 const nCurrentParagraph =
5851 rPropReader.aCharPropList[rnCurCharPos]->mnParagraph;
5852 for (; rnCurCharPos < rPropReader.aCharPropList.size() &&
5853 rPropReader.aCharPropList[rnCurCharPos]->mnParagraph == nCurrentParagraph;
5854 ++rnCurCharPos)
5855 {
5856 PPTCharPropSet *const pCharPropSet =
5857 rPropReader.aCharPropList[rnCurCharPos].get();
5858 std::unique_ptr<PPTPortionObj> pPPTPortion(new PPTPortionObj(
5859 *pCharPropSet, rStyleSheet, nInstance, mxParaSet->mnDepth));
5860 m_PortionList.push_back(std::move(pPPTPortion));
5861 }
5862}
5863
5865{
5866}
5867
5869{
5870 m_PortionList.push_back(
5871 std::make_unique<PPTPortionObj>(rPPTPortion));
5872}
5873
5874void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
5875{
5876 if ( nBulletRelSize <= 0x7fff ) // a negative value is the absolute bullet height
5877 return;
5878
5879 sal_uInt16 nFontHeight = 0;
5880 if (!m_PortionList.empty())
5881 {
5882 PPTPortionObj const& rPortion = *m_PortionList.front();
5883 if (rPortion.mpImplPPTCharPropSet->mnAttrSet & (1 << PPT_CharAttr_FontHeight))
5884 {
5885 nFontHeight = rPortion.mpImplPPTCharPropSet->mnFontHeight;
5886 }
5887 }
5888 // if we do not have a hard attributed fontheight, the fontheight is taken from the style
5889 if ( !nFontHeight )
5890 {
5891 nFontHeight = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[sanitizeForMaxPPTLevels(mxParaSet->mnDepth)].mnFontHeight;
5892 }
5893 nBulletRelSize = nFontHeight ? ((- static_cast<sal_Int16>(nBulletRelSize)) * 100 ) / nFontHeight : 100;
5894}
5895
5896bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Type nDestinationInstance )
5897{
5898 sal_uInt32 nMask = 1 << nAttr;
5899 rRetValue = 0;
5900
5901 if ( nAttr > 21 )
5902 {
5903 OSL_FAIL( "SJ:PPTParagraphObj::GetAttrib - attribute does not exist" );
5904 return false;
5905 }
5906
5907 bool bIsHardAttribute = ( ( mxParaSet->mnAttrSet & nMask ) != 0 );
5908
5909 sal_uInt16 nDepth = sanitizeForMaxPPTLevels(mxParaSet->mnDepth);
5910
5911 if ( bIsHardAttribute )
5912 {
5913 if ( nAttr == PPT_ParaAttr_BulletColor )
5914 {
5915 bool bHardBulletColor;
5916 if ( mxParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardColor ) )
5917 bHardBulletColor = mxParaSet->mpArry[ PPT_ParaAttr_BuHardColor ] != 0;
5918 else
5919 bHardBulletColor = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[nDepth].mnBuFlags
5920 & ( 1 << PPT_ParaAttr_BuHardColor ) ) != 0;
5921 if ( bHardBulletColor )
5922 rRetValue = mxParaSet->mnBulletColor;
5923 else
5924 {
5926 if ((nDestinationInstance != TSS_Type::Unknown) && !m_PortionList.empty())
5927 {
5928 PPTPortionObj const& rPortion = *m_PortionList.front();
5929 if (rPortion.mpImplPPTCharPropSet->mnAttrSet & (1 << PPT_CharAttr_FontColor))
5930 {
5931 rRetValue = rPortion.mpImplPPTCharPropSet->mnColor;
5932 }
5933 else
5934 {
5935 rRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[nDepth].mnFontColor;
5936 }
5937 }
5938 }
5939 }
5940 else if ( nAttr == PPT_ParaAttr_BulletFont )
5941 {
5942 bool bHardBuFont;
5943 if ( mxParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardFont ) )
5944 bHardBuFont = mxParaSet->mpArry[ PPT_ParaAttr_BuHardFont ] != 0;
5945 else
5946 bHardBuFont = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[nDepth].mnBuFlags
5947 & ( 1 << PPT_ParaAttr_BuHardFont ) ) != 0;
5948 if ( bHardBuFont )
5949 rRetValue = mxParaSet->mpArry[ PPT_ParaAttr_BulletFont ];
5950 else
5951 {
5952 // it is the font used which assigned to the first character of the following text
5953 rRetValue = 0;
5954 if ((nDestinationInstance != TSS_Type::Unknown) && !m_PortionList.empty())
5955 {
5956 PPTPortionObj const& rPortion = *m_PortionList.front();
5957 if (rPortion.mpImplPPTCharPropSet->mnAttrSet & ( 1 << PPT_CharAttr_Font ) )
5958 {
5959 rRetValue = rPortion.mpImplPPTCharPropSet->mnFont;
5960 }
5961 else
5962 {
5963 rRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[nDepth].mnFont;
5964 }
5965 }
5966 }
5967 }
5968 else
5969 rRetValue = mxParaSet->mpArry[ nAttr ];
5970 }
5971 else
5972 {
5973 const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[nDepth];
5974
5975 PPTParaLevel* pParaLevel = nullptr;
5976 if ( ( nDestinationInstance == TSS_Type::Unknown )
5977 || ( nDepth && ( ( mnInstance == TSS_Type::Subtitle ) || ( mnInstance == TSS_Type::TextInShape ) ) ) )
5978 bIsHardAttribute = true;
5979 else if ( nDestinationInstance != mnInstance )
5980 pParaLevel = &mrStyleSheet.mpParaSheet[ nDestinationInstance ]->maParaLevel[nDepth];
5981 switch ( nAttr )
5982 {
5984 {
5985 rRetValue = rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn );
5986 if ( pParaLevel )
5987 {
5988 if ( rRetValue != ( static_cast<sal_uInt32>(pParaLevel->mnBuFlags) & ( 1 << PPT_ParaAttr_BulletOn ) ) )
5989 bIsHardAttribute = true;
5990 }
5991 }
5992 break;
5996 OSL_FAIL( "SJ:PPTParagraphObj::GetAttrib - this attribute does not make sense" );
5997 break;
5999 {
6000 rRetValue = rParaLevel.mnBulletChar;
6001 if ( pParaLevel && ( rRetValue != pParaLevel->mnBulletChar ) )
6002 bIsHardAttribute = true;
6003 }
6004 break;
6006 {
6007 bool bHardBuFont;
6008 if ( mxParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardFont ) )
6009 bHardBuFont = mxParaSet->mpArry[ PPT_ParaAttr_BuHardFont ] != 0;
6010 else
6011 bHardBuFont = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardFont ) ) != 0;
6012 if ( bHardBuFont )
6013 {
6014 rRetValue = rParaLevel.mnBulletFont;
6015 if ( pParaLevel && ( rRetValue != pParaLevel->mnBulletFont ) )
6016 bIsHardAttribute = true;
6017 }
6018 else
6019 {
6020 if (!m_PortionList.empty())
6021 {
6022 PPTPortionObj const& rPortion = *m_PortionList.front();
6023 bIsHardAttribute = rPortion.GetAttrib(
6024 PPT_CharAttr_Font, rRetValue, nDestinationInstance);
6025 }
6026 else
6027 {
6028 rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[nDepth].mnFont;
6029 bIsHardAttribute = true;
6030 }
6031 }
6032 }
6033 break;
6035 {
6036 rRetValue = rParaLevel.mnBulletHeight;
6037 if ( pParaLevel && ( rRetValue != pParaLevel->mnBulletHeight ) )
6038 bIsHardAttribute = true;
6039 }
6040 break;
6042 {
6043 bool bHardBulletColor;
6044 if ( mxParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardColor ) )
6045 bHardBulletColor = mxParaSet->mpArry[ PPT_ParaAttr_BuHardColor ] != 0;
6046 else
6047 bHardBulletColor = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardColor ) ) != 0;
6048 if ( bHardBulletColor )
6049 {
6050 rRetValue = rParaLevel.mnBulletColor;
6051 if ( pParaLevel && ( rRetValue != pParaLevel->mnBulletColor ) )
6052 bIsHardAttribute = true;
6053 }
6054 else
6055 {
6056 if (!m_PortionList.empty())
6057 {
6058 PPTPortionObj const& rPortion = *m_PortionList.front();
6059 if (rPortion.mbIsHyperlink )
6060 {
6061 if( rPortion.mbHardHylinkOrigColor )
6062 rRetValue = rPortion.mnHylinkOrigColor;
6063 else
6064 rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[nDepth].mnFontColor;
6065 bIsHardAttribute = true;
6066 }
6067 else
6068 {
6069 bIsHardAttribute = rPortion.GetAttrib( PPT_CharAttr_FontColor, rRetValue, nDestinationInstance );
6070 }
6071 }
6072 else
6073 {
6074 rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[nDepth].mnFontColor;
6075 bIsHardAttribute = true;
6076 }
6077 }
6078 }
6079 break;
6080 case PPT_ParaAttr_Adjust :
6081 {
6082 rRetValue = rParaLevel.mnAdjust;
6083 if ( pParaLevel && ( rRetValue != pParaLevel->mnAdjust ) )
6084 bIsHardAttribute = true;
6085 }
6086 break;
6088 {
6089 rRetValue = rParaLevel.mnLineFeed;
6090 if ( pParaLevel && ( rRetValue != pParaLevel->mnLineFeed ) )
6091 bIsHardAttribute = true;
6092 }
6093 break;
6095 {
6096 rRetValue = rParaLevel.mnUpperDist;
6097 if ( pParaLevel && ( rRetValue != pParaLevel->mnUpperDist ) )
6098 bIsHardAttribute = true;
6099 }
6100 break;
6102 {
6103 rRetValue = rParaLevel.mnLowerDist;
6104 if ( pParaLevel && ( rRetValue != pParaLevel->mnLowerDist ) )
6105 bIsHardAttribute = true;
6106 }
6107 break;
6109 {
6110 rRetValue = rParaLevel.mnTextOfs;
6111 if ( pParaLevel && ( rRetValue != pParaLevel->mnTextOfs ) )
6112 bIsHardAttribute = true;
6113 }
6114 break;
6116 {
6117 rRetValue = rParaLevel.mnBulletOfs;
6118 if ( pParaLevel && ( rRetValue != pParaLevel->mnBulletOfs ) )
6119 bIsHardAttribute = true;
6120 }
6121 break;
6123 {
6124 rRetValue = rParaLevel.mnDefaultTab;
6125 if ( pParaLevel && ( rRetValue != pParaLevel->mnDefaultTab ) )
6126 bIsHardAttribute = true;
6127 }
6128 break;
6130 {
6131 rRetValue = rParaLevel.mnAsianLineBreak & 1;
6132 if ( pParaLevel && ( rRetValue != ( static_cast<sal_uInt32>(pParaLevel->mnAsianLineBreak) & 1 ) ) )
6133 bIsHardAttribute = true;
6134 }
6135 break;
6137 {
6138 rRetValue = ( rParaLevel.mnAsianLineBreak >> 1 ) & 1;
6139 if ( pParaLevel && ( rRetValue != ( ( static_cast<sal_uInt32>(pParaLevel->mnAsianLineBreak) >> 1 ) & 1 ) ) )
6140 bIsHardAttribute = true;
6141 }
6142 break;
6144 {
6145 rRetValue = ( rParaLevel.mnAsianLineBreak >> 2 ) & 1;
6146 if ( pParaLevel && ( rRetValue != ( ( static_cast<sal_uInt32>(pParaLevel->mnAsianLineBreak) >> 2 ) & 1 ) ) )
6147 bIsHardAttribute = true;
6148 }
6149 break;
6150 case PPT_ParaAttr_BiDi :
6151 {
6152 rRetValue = rParaLevel.mnBiDi;
6153 if ( pParaLevel && ( rRetValue != pParaLevel->mnBiDi ) )
6154 bIsHardAttribute = true;
6155 }
6156 break;
6157 }
6158 }
6159 return bIsHardAttribute;
6160}
6161
6162void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, std::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport const & rManager, TSS_Type nDestinationInstance )
6163{
6164 sal_Int16 nVal2;
6165 sal_uInt32 nVal, nUpperDist, nLowerDist;
6166 TSS_Type nInstance = nDestinationInstance != TSS_Type::Unknown ? nDestinationInstance : mnInstance;
6167
6168 if ( ( nDestinationInstance != TSS_Type::Unknown ) || ( mxParaSet->mnDepth <= 1 ) )
6169 {
6170 SvxNumBulletItem* pNumBulletItem = mrStyleSheet.mpNumBulletItem[ nInstance ].get();
6171 if ( pNumBulletItem )
6172 {
6173 SvxNumberFormat aNumberFormat( SVX_NUM_NUMBER_NONE );
6174 if ( GetNumberFormat( rManager, aNumberFormat, this, nDestinationInstance, rStartNumbering ) )
6175 {
6176 if ( aNumberFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE )
6177 {
6178 aNumberFormat.SetAbsLSpace( 0 );
6179 aNumberFormat.SetFirstLineOffset( 0 );
6180 aNumberFormat.SetCharTextDistance( 0 );
6181 aNumberFormat.SetFirstLineIndent( 0 );
6182 aNumberFormat.SetIndentAt( 0 );
6183 }
6184 SvxNumBulletItem aNewNumBulletItem( *pNumBulletItem );
6185 SvxNumRule& rRule = aNewNumBulletItem.GetNumRule();
6186 rRule.SetLevel( mxParaSet->mnDepth, aNumberFormat );
6187 for (sal_uInt16 i = 0; i < rRule.GetLevelCount(); ++i)
6188 {
6189 if ( i != mxParaSet->mnDepth )
6190 {
6191 sal_uInt16 n = sanitizeForMaxPPTLevels(i);
6192
6193 SvxNumberFormat aNumberFormat2( rRule.GetLevel( i ) );
6194 const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ nInstance ]->maParaLevel[ n ];
6195 const PPTCharLevel& rCharLevel = mrStyleSheet.mpCharSheet[ nInstance ]->maCharLevel[ n ];
6196 sal_uInt32 nColor;
6197 if ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BuHardColor ) )
6198 nColor = rParaLevel.mnBulletColor;
6199 else
6200 nColor = rCharLevel.mnFontColor;
6201 aNumberFormat2.SetBulletColor( rManager.MSO_TEXT_CLR_ToColor( nColor ) );
6202 rRule.SetLevel( i, aNumberFormat2 );
6203 }
6204 }
6205 rSet.Put( aNewNumBulletItem );
6206 }
6207 }
6208 }
6209
6210 sal_uInt32 nIsBullet2, _nTextOfs, _nBulletOfs;
6211 GetAttrib(PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance);
6212 GetAttrib(PPT_ParaAttr_TextOfs, _nTextOfs, nDestinationInstance);
6213 GetAttrib(PPT_ParaAttr_BulletOfs, _nBulletOfs, nDestinationInstance);
6214 SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
6215 if ( !nIsBullet2 )
6216 {
6217 auto const nAbsLSpace = convertMasterUnitToMm100(_nTextOfs);
6218 auto const nFirstLineOffset = nAbsLSpace - convertMasterUnitToMm100(_nBulletOfs);
6220 aLRSpaceItem.SetTextLeft( nAbsLSpace );
6221 }
6222 rSet.Put( aLRSpaceItem );
6223
6224 if ( GetAttrib( PPT_ParaAttr_Adjust, nVal, nDestinationInstance ) )
6225 {
6226 if ( nVal <= 3 )
6227 { // paragraph adjustment
6228 static SvxAdjust const aAdj[ 4 ] = { SvxAdjust::Left, SvxAdjust::Center, SvxAdjust::Right, SvxAdjust::Block };
6229 rSet.Put( SvxAdjustItem( aAdj[ nVal ], EE_PARA_JUST ) );
6230 }
6231 }
6232
6233 if ( GetAttrib( PPT_ParaAttr_AsianLB_1, nVal, nDestinationInstance ) )
6235 if ( GetAttrib( PPT_ParaAttr_AsianLB_3, nVal, nDestinationInstance ) )
6237
6238 if ( GetAttrib( PPT_ParaAttr_BiDi, nVal, nDestinationInstance ) )
6239 rSet.Put( SvxFrameDirectionItem( nVal == 1 ? SvxFrameDirection::Horizontal_RL_TB : SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
6240
6241 // LineSpacing
6242 PPTPortionObj* pPortion = First();
6243 bool bIsHardAttribute = GetAttrib( PPT_ParaAttr_LineFeed, nVal, nDestinationInstance );
6244 nVal2 = static_cast<sal_Int16>(nVal);
6245 sal_uInt32 nFont = sal_uInt32();
6246 if ( pPortion && pPortion->GetAttrib( PPT_CharAttr_Font, nFont, nDestinationInstance ) )
6247 bIsHardAttribute = true;
6248
6249 if ( bIsHardAttribute )
6250 {
6251 SdrTextFixedCellHeightItem aHeightItem(true);
6252 aHeightItem.SetWhich(SDRATTR_TEXT_USEFIXEDCELLHEIGHT);
6253 rSet.Put( aHeightItem );
6254 SvxLineSpacingItem aItem( 200, EE_PARA_SBL );
6255 if ( nVal2 <= 0 ) {
6256 aItem.SetLineHeight( static_cast<sal_uInt16>( rManager.ScalePoint( -nVal2 ) / 8 ) );
6257 aItem.SetLineSpaceRule( SvxLineSpaceRule::Fix );
6258 aItem.SetInterLineSpaceRule(SvxInterLineSpaceRule::Off);
6259 } else
6260 {
6261 sal_uInt16 nPropLineSpace = static_cast<sal_uInt16>(nVal2);
6262 aItem.SetPropLineSpace( nPropLineSpace );
6263 aItem.SetLineSpaceRule( SvxLineSpaceRule::Auto );
6264 }
6265 rSet.Put( aItem );
6266 }
6267
6268 // Paragraph Spacing
6269 bIsHardAttribute = ( static_cast<sal_uInt32>(GetAttrib( PPT_ParaAttr_UpperDist, nUpperDist, nDestinationInstance )) +
6270 static_cast<sal_uInt32>(GetAttrib( PPT_ParaAttr_LowerDist, nLowerDist, nDestinationInstance )) ) != 0;
6271 if ( ( nUpperDist > 0 ) || ( nLowerDist > 0 ) )
6272 {
6273 if (!m_PortionList.empty())
6274 {
6275 sal_uInt32 nFontHeight = 0;
6276 m_PortionList.back()->GetAttrib(
6277 PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance);
6278 if ( static_cast<sal_Int16>(nUpperDist) > 0 )
6279 nUpperDist = - static_cast<sal_Int16>( ( nFontHeight * nUpperDist * 100 ) / 1000 );
6280 if ( static_cast<sal_Int16>(nLowerDist) > 0 )
6281 nLowerDist = - static_cast<sal_Int16>( ( nFontHeight * nLowerDist * 100 ) / 1000 );
6282 }
6283 bIsHardAttribute = true;
6284 }
6285 if ( bIsHardAttribute )
6286 {
6287 SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE );
6288 nVal2 = static_cast<sal_Int16>(nUpperDist);
6289 if ( nVal2 <= 0 )
6290 aULSpaceItem.SetUpper(static_cast<sal_uInt16>(convertMasterUnitToMm100(-nVal2)));
6291 else
6292 {
6293 aULSpaceItem.SetUpperValue( 0 );
6294 aULSpaceItem.SetPropUpper( static_cast<sal_uInt16>(nUpperDist) == 100 ? 101 : static_cast<sal_uInt16>(nUpperDist) );
6295 }
6296 nVal2 = static_cast<sal_Int16>(nLowerDist);
6297 if ( nVal2 <= 0 )
6298 aULSpaceItem.SetLower(static_cast<sal_uInt16>(convertMasterUnitToMm100(-nVal2)));
6299 else
6300 {
6301 aULSpaceItem.SetLowerValue( 0 );
6302 aULSpaceItem.SetPropLower( static_cast<sal_uInt16>(nLowerDist) == 100 ? 101 : static_cast<sal_uInt16>(nLowerDist) );
6303 }
6304 rSet.Put( aULSpaceItem );
6305 }
6306
6307 sal_uInt32 i, nDefaultTab, nTab, nTextOfs2 = 0;
6308 sal_uInt32 nLatestManTab = 0;
6309 GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance );
6310 GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance );
6311 GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance );
6312
6313 SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS );
6314 if ( GetTabCount() )
6315 {
6316 for ( i = 0; i < GetTabCount(); i++ )
6317 {
6318 SvxTabAdjust eTabAdjust;
6319 nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) );
6320 switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) )
6321 {
6322 case 1 : eTabAdjust = SvxTabAdjust::Center; break;
6323 case 2 : eTabAdjust = SvxTabAdjust::Right; break;
6324 case 3 : eTabAdjust = SvxTabAdjust::Decimal; break;
6325 default : eTabAdjust = SvxTabAdjust::Left;
6326 }
6327 aTabItem.Insert(SvxTabStop(convertMasterUnitToMm100(nTab), eTabAdjust));
6328 }
6329 nLatestManTab = nTab;
6330 }
6331 if ( nIsBullet2 == 0 )
6332 aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) );
6333 if ( nDefaultTab )
6334 {
6335 nTab = std::max( nTextOfs2, nLatestManTab );
6336 nTab /= nDefaultTab;
6337 nTab = nDefaultTab * ( 1 + nTab );
6338 for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ )
6339 {
6340 aTabItem.Insert( SvxTabStop( convertMasterUnitToMm100(nTab)));
6341 nTab += nDefaultTab;
6342 }
6343 }
6344 rSet.Put( aTabItem );
6345}
6346
6348{
6349 sal_uInt32 nCount, nRetValue = 0;
6350 for (const std::unique_ptr<PPTPortionObj> & i : m_PortionList)
6351 {
6352 PPTPortionObj const& rPortionObj = *i;
6353 nCount = rPortionObj.Count();
6354 if ((!nCount) && rPortionObj.mpFieldItem)
6355 nCount++;
6356 nRetValue += nCount;
6357 }
6358 return nRetValue;
6359}
6360
6362{
6363 mnCurrentObject = 0;
6364 if (m_PortionList.empty())
6365 return nullptr;
6366 return m_PortionList.front().get();
6367}
6368
6370{
6371 sal_uInt32 i = mnCurrentObject + 1;
6372 if (i >= m_PortionList.size())
6373 return nullptr;
6375 return m_PortionList[i].get();
6376}
6377
6379{
6380}
6381
6382void PPTFieldEntry::GetDateTime( const sal_uInt32 nVal, SvxDateFormat& eDateFormat, SvxTimeFormat& eTimeFormat )
6383{
6384 eDateFormat = SvxDateFormat::AppDefault;
6385 eTimeFormat = SvxTimeFormat::AppDefault;
6386 // evaluate ID
6387 switch( nVal )
6388 {
6389 case 0:
6390 case 6:
6391 eDateFormat = SvxDateFormat::A;
6392 break;
6393 case 1:
6394 eDateFormat = SvxDateFormat::F;
6395 break;
6396 case 2:
6397 case 3:
6398 eDateFormat = SvxDateFormat::D;
6399 break;
6400 case 4:
6401 case 5:
6402 eDateFormat = SvxDateFormat::C;
6403 break;
6404 case 7:
6405 eDateFormat = SvxDateFormat::A;
6406 [[fallthrough]];
6407 case 9:
6408 eTimeFormat = SvxTimeFormat::HH24_MM;
6409 break;
6410 case 8:
6411 eDateFormat = SvxDateFormat::A;
6412 [[fallthrough]];
6413 case 11:
6414 eTimeFormat = SvxTimeFormat::HH12_MM;
6415 break;
6416 case 10:
6417 eTimeFormat = SvxTimeFormat::HH24_MM_SS;
6418 break;
6419 case 12:
6420 eTimeFormat = SvxTimeFormat::HH12_MM_SS;
6421 break;
6422 }
6423}
6424
6425void PPTFieldEntry::SetDateTime( sal_uInt32 nVal )
6426{
6427 SvxDateFormat eDateFormat;
6428 SvxTimeFormat eTimeFormat;
6429 GetDateTime( nVal, eDateFormat, eTimeFormat );
6430 if ( eDateFormat != SvxDateFormat::AppDefault )
6431 xField1.reset(new SvxFieldItem(SvxDateField( Date( Date::SYSTEM ), SvxDateType::Var, eDateFormat ), EE_FEATURE_FIELD));
6432 if ( eTimeFormat != SvxTimeFormat::AppDefault )
6433 {
6434 std::unique_ptr<SvxFieldItem> xFieldItem(new SvxFieldItem(SvxExtTimeField( tools::Time( tools::Time::SYSTEM ), SvxTimeType::Var, eTimeFormat ), EE_FEATURE_FIELD));
6435 if (xField1)
6436 xField2 = std::move(xFieldItem);
6437 else
6438 xField1 = std::move(xFieldItem);
6439 }
6440}
6441
6442PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport, PptSlidePersistEntry& rPersistEntry, DffObjData const * pObjData ) :
6443 mxImplTextObj ( new ImplPPTTextObj( rPersistEntry ) )
6444{
6445 mxImplTextObj->mnShapeId = 0;
6446 mxImplTextObj->mnShapeMaster = 0;
6447 mxImplTextObj->mnDestinationInstance = mxImplTextObj->mnInstance = TSS_Type::TextInShape;
6448 mxImplTextObj->mnCurrentObject = 0;
6449 mxImplTextObj->mnParagraphCount = 0;
6450 mxImplTextObj->mnTextFlags = 0;
6451 mxImplTextObj->meShapeType = ( pObjData && pObjData->bShapeType ) ? pObjData->eShapeType : mso_sptMin;
6452
6453 DffRecordHeader aExtParaHd;
6454 aExtParaHd.nRecType = 0; // set empty
6455
6456
6457 DffRecordHeader aShapeContainerHd;
6458 ReadDffRecordHeader( rIn, aShapeContainerHd );
6459
6460 if ( !(( pObjData == nullptr ) || ( pObjData->bShapeType )) )
6461 return;
6462
6463 PPTExtParaProv* pExtParaProv = rSdrPowerPointImport.m_pPPTStyleSheet->pExtParaProv.get();
6464 if ( pObjData )
6465 {
6466 mxImplTextObj->mnShapeId = pObjData->nShapeId;
6467 if ( pObjData->nSpFlags & ShapeFlag::HaveMaster )
6468 mxImplTextObj->mnShapeMaster = rSdrPowerPointImport.GetPropertyValue( DFF_Prop_hspMaster, 0 );
6469 }
6470 // ClientData
6472 {
6473 sal_uInt32 nOldPos = rIn.Tell();
6474 DffRecordHeader& aClientDataContainerHd = *rSdrPowerPointImport.maShapeRecords.Current();
6475 DffRecordHeader aPlaceHolderAtomHd;
6476 if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_OEPlaceholderAtom, aClientDataContainerHd.GetRecEndFilePos(), &aPlaceHolderAtomHd ) )
6477 {
6478 mxImplTextObj->moPlaceHolderAtom.emplace();
6479 ReadPptOEPlaceholderAtom( rIn, *( mxImplTextObj->moPlaceHolderAtom ) );
6480 }
6481 rIn.Seek( nOldPos );
6482 DffRecordHeader aProgTagHd;
6483 if ( SdrPowerPointImport::SeekToContentOfProgTag( 9, rIn, aClientDataContainerHd, aProgTagHd ) )
6484 {
6485 ReadDffRecordHeader( rIn, aExtParaHd );
6486 }
6487 }
6488
6489 // ClientTextBox
6491 return;
6492
6493 bool bStatus = true;
6494
6495
6496 DffRecordHeader aClientTextBoxHd( *rSdrPowerPointImport.maShapeRecords.Current() );
6497 sal_uInt32 nTextRulerAtomOfs = 0; // case of zero -> this atom may be found in aClientDataContainerHd;
6498 // case of -1 -> there is no atom of this kind
6499 // else -> this is the fileofs where we can get it
6500
6501 // checkout if this is a referenced
6502 // textobj, if so the we will patch
6503 // the ClientTextBoxHd for a
6504 // equivalent one
6505 DffRecordHeader aTextHd;
6506 if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_OutlineTextRefAtom, aClientTextBoxHd.GetRecEndFilePos(), &aTextHd ) )
6507 {
6508 sal_uInt32 nRefNum;
6509 rIn.ReadUInt32( nRefNum );
6510
6511 if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_TextRulerAtom, aClientTextBoxHd.GetRecEndFilePos() ) )
6512 nTextRulerAtomOfs = rIn.Tell();
6513 else
6514 nTextRulerAtomOfs = 0xffffffff;
6515
6516 switch( rSdrPowerPointImport.m_eCurrentPageKind )
6517 {
6518 case PPT_NOTEPAGE :
6519 case PPT_MASTERPAGE :
6520 case PPT_SLIDEPAGE :
6521 break;
6522 default :
6523 bStatus = false;
6524 }
6525 if ( bStatus )
6526 {
6527 sal_uInt32 nSlideId = rSdrPowerPointImport.GetCurrentPageId();
6528 if ( !nSlideId )
6529 bStatus = false;
6530 else
6531 {
6532 if ( !aExtParaHd.nRecType )
6533 {
6534 sal_uInt32 nOldPos = rIn.Tell();
6535 // try to locate the referenced ExtendedParaHd
6536 DffRecordHeader* pHd = pExtParaProv->
6537 aExtendedPresRules.GetRecordHeader( PPT_PST_ExtendedParagraphHeaderAtom,
6539 DffRecordHeader aPresRuleHd;
6540 DffRecordHeader* pFirst = pHd;
6541
6542 while ( pHd )
6543 {
6544 pHd->SeekToContent( rIn );
6545 sal_uInt32 nTmpSlideId(0), nTmpRef;
6546 rIn.ReadUInt32( nTmpSlideId )
6547 .ReadUInt32( nTmpRef ); // this seems to be the instance
6548
6549 if ( ( nTmpSlideId == nSlideId ) && ( pHd->nRecInstance == nRefNum ) )
6550 {
6551 if (!pHd->SeekToEndOfRecord(rIn))
6552 break;
6553 ReadDffRecordHeader( rIn, aPresRuleHd );
6554 if ( aPresRuleHd.nRecType == PPT_PST_ExtendedParagraphAtom )
6555 {
6556 aExtParaHd = aPresRuleHd;
6557 break;
6558 }
6559 }
6560 pHd = pExtParaProv->
6561 aExtendedPresRules.GetRecordHeader( PPT_PST_ExtendedParagraphHeaderAtom,
6563 if ( pHd == pFirst )
6564 break;
6565 }
6566 rIn.Seek( nOldPos );
6567 }
6568 // now pHd points to the right SlideListWithText Container
6569 PptSlidePersistList* pPageList = rSdrPowerPointImport.GetPageList( rSdrPowerPointImport.m_eCurrentPageKind );
6570 PptSlidePersistEntry* pE = nullptr;
6571 if ( pPageList && ( rSdrPowerPointImport.m_nCurrentPageNum < pPageList->size() ) )
6572 pE = &(*pPageList)[ rSdrPowerPointImport.m_nCurrentPageNum ];
6573 if ( (!pE) || (!pE->nSlidePersistStartOffset) || ( pE->aPersistAtom.nSlideId != nSlideId ) )
6574 bStatus = false;
6575 else
6576 {
6577 auto nOffset(pE->nSlidePersistStartOffset);
6578 bStatus = (nOffset == rIn.Seek(nOffset));
6579 // now we got the right page and are searching for the right
6580 // TextHeaderAtom
6581 auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, pE->nSlidePersistEndOffset);
6582 while (bStatus && rIn.Tell() < nEndRecPos)
6583 {
6584 ReadDffRecordHeader( rIn, aClientTextBoxHd );
6585 if ( aClientTextBoxHd.nRecType == PPT_PST_TextHeaderAtom )
6586 {
6587 if ( aClientTextBoxHd.nRecInstance == nRefNum )
6588 {
6589 aClientTextBoxHd.SeekToEndOfRecord( rIn );
6590 break;
6591 }
6592 }
6593 if (!aClientTextBoxHd.SeekToEndOfRecord(rIn))
6594 break;
6595 }
6596 if ( rIn.Tell() > pE->nSlidePersistEndOffset )
6597 bStatus = false;
6598 else
6599 { // patching the RecordHeader
6600 aClientTextBoxHd.nFilePos -= DFF_COMMON_RECORD_HEADER_SIZE;
6601 aClientTextBoxHd.nRecLen += DFF_COMMON_RECORD_HEADER_SIZE;
6602 aClientTextBoxHd.nRecType = DFF_msofbtClientTextbox;
6603 aClientTextBoxHd.nRecVer = DFF_PSFLAG_CONTAINER;
6604
6605 // we have to calculate the correct record len
6606 DffRecordHeader aTmpHd;
6607 nEndRecPos = DffPropSet::SanitizeEndPos(rIn, pE->nSlidePersistEndOffset);
6608 while (rIn.Tell() < nEndRecPos)
6609 {
6610 ReadDffRecordHeader( rIn, aTmpHd );
6611 if ( ( aTmpHd.nRecType == PPT_PST_SlidePersistAtom ) || ( aTmpHd.nRecType == PPT_PST_TextHeaderAtom ) )
6612 break;
6613 if (!aTmpHd.SeekToEndOfRecord(rIn))
6614 break;
6615 aClientTextBoxHd.nRecLen += aTmpHd.nRecLen + DFF_COMMON_RECORD_HEADER_SIZE;
6616 }
6617 aClientTextBoxHd.SeekToContent( rIn );
6618 }
6619 }
6620 }
6621 }
6622 }
6623
6624 if ( !bStatus )
6625 return;
6626
6627 if ( !SvxMSDffManager::SeekToRec( rIn, PPT_PST_TextHeaderAtom, aClientTextBoxHd.GetRecEndFilePos(), &aTextHd ) )
6628 return;
6629
6630 // TextHeaderAtom is always the first Atom
6631 sal_uInt16 nTmp(0);
6632 rIn.ReadUInt16(nTmp); // this number tells us the TxMasterStyleAtom Instance
6633 if (nTmp > 8)
6634 nTmp = 4;
6635 TSS_Type nInstance = static_cast<TSS_Type>(nTmp);
6636 aTextHd.SeekToEndOfRecord( rIn );
6637 mxImplTextObj->mnInstance = nInstance;
6638
6639 sal_uInt32 nFilePos = rIn.Tell();
6640 if ( !(rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom,
6642 aClientTextBoxHd.GetRecEndFilePos() )
6645 aClientTextBoxHd.GetRecEndFilePos() )) )
6646 return;
6647
6648 PPTTextRulerInterpreter aTextRulerInterpreter( nTextRulerAtomOfs, aClientTextBoxHd, rIn );
6649
6650 PPTStyleTextPropReader aStyleTextPropReader( rIn, aClientTextBoxHd,
6651 aTextRulerInterpreter, aExtParaHd, nInstance );
6652 sal_uInt32 nParagraphs = mxImplTextObj->mnParagraphCount = aStyleTextPropReader.aParaPropList.size();
6653 if ( !nParagraphs )
6654 return;
6655
6656 // the language settings will be merged into the list of PPTCharPropSet
6657 DffRecordHeader aTextSpecInfoHd;
6658 PPTTextSpecInfoAtomInterpreter aTextSpecInfoAtomInterpreter;
6660 aClientTextBoxHd.GetRecEndFilePos(), &aTextSpecInfoHd ) )
6661 {
6662 if ( aTextSpecInfoAtomInterpreter.Read( rIn, aTextSpecInfoHd, PPT_PST_TextSpecInfoAtom,
6663 &(rSdrPowerPointImport.m_pPPTStyleSheet->maTxSI) ) )
6664 {
6665 size_t nI = 0;
6666 for (const PPTTextSpecInfo& rSpecInfo : aTextSpecInfoAtomInterpreter.aList)
6667 {
6668 sal_uInt32 nCharIdx = rSpecInfo.nCharIdx;
6669
6670 // portions and text have to been split in some cases
6671 for ( ; nI < aStyleTextPropReader.aCharPropList.size(); ++nI)
6672 {
6673 PPTCharPropSet* pSet = aStyleTextPropReader.aCharPropList[nI].get();
6674 if (pSet->mnOriginalTextPos >= nCharIdx)
6675 break;
6676 pSet->mnLanguage[0] = rSpecInfo.nLanguage[0];
6677 pSet->mnLanguage[1] = rSpecInfo.nLanguage[1];
6678 pSet->mnLanguage[2] = rSpecInfo.nLanguage[2];
6679 // test if the current portion needs to be split
6680 if (pSet->maString.getLength() <= 1)
6681 continue;
6682 sal_Int32 nIndexOfNextPortion = pSet->maString.getLength() + pSet->mnOriginalTextPos;
6683 sal_Int32 nNewLen = nIndexOfNextPortion - nCharIdx;
6684 if (nNewLen <= 0)
6685 continue;
6686 sal_Int32 nOldLen = pSet->maString.getLength() - nNewLen;
6687 if (nOldLen <= 0)
6688 continue;
6689 OUString aString(pSet->maString);
6690 PPTCharPropSet* pNew = new PPTCharPropSet(*pSet);
6691 pSet->maString = aString.copy(0, nOldLen);
6692 pNew->maString = aString.copy(nOldLen, nNewLen);
6693 pNew->mnOriginalTextPos += nOldLen;
6694 aStyleTextPropReader.aCharPropList.emplace(aStyleTextPropReader.aCharPropList.begin() + nI + 1, pNew);
6695 }
6696 }
6697 }
6698#ifdef DBG_UTIL
6699 else
6700 {
6701 if (!(rSdrPowerPointImport.rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT))
6702 {
6703 OSL_FAIL( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" );
6704 }
6705 }
6706#endif
6707 }
6708 // now will search for possible textextensions such as date/time fields
6709 // or ParaTabStops and append them on this textobj
6710 rIn.Seek( nFilePos );
6711 ::std::vector< std::unique_ptr<PPTFieldEntry> > FieldList;
6712 auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, aClientTextBoxHd.GetRecEndFilePos());
6713 while (rIn.Tell() < nEndRecPos)
6714 {
6715 ReadDffRecordHeader( rIn, aTextHd );
6716 sal_uInt16 nVal = 0;
6717 std::unique_ptr<PPTFieldEntry> xEntry;
6718 switch ( aTextHd.nRecType )
6719 {
6721 {
6722 xEntry.reset(new PPTFieldEntry);
6723 rIn.ReadUInt16(xEntry->nPos)
6724 .ReadUInt16( nVal )
6725 .ReadUInt16( nVal );
6726 xEntry->SetDateTime( nVal & 0xff );
6727 }
6728 break;
6729
6731 {
6732 xEntry.reset(new PPTFieldEntry);
6733 rIn.ReadUInt16(xEntry->nPos);
6734 xEntry->xField1.reset(new SvxFieldItem(SvxFooterField(), EE_FEATURE_FIELD));
6735 }
6736 break;
6737
6739 {
6740 xEntry.reset(new PPTFieldEntry);
6741 rIn.ReadUInt16(xEntry->nPos);
6742 xEntry->xField1.reset(new SvxFieldItem(SvxHeaderField(), EE_FEATURE_FIELD));
6743 }
6744 break;
6745
6747 {
6748 xEntry.reset(new PPTFieldEntry);
6749 rIn.ReadUInt16(xEntry->nPos);
6750 xEntry->xField1.reset(new SvxFieldItem(SvxDateTimeField(), EE_FEATURE_FIELD));
6751 if (rPersistEntry.xHeaderFooterEntry) // sj: #i34111# on master pages it is possible
6752 { // that there is no HeaderFooterEntry available
6753 if (rPersistEntry.xHeaderFooterEntry->nAtom & 0x20000) // auto date time
6754 xEntry->SetDateTime(rPersistEntry.xHeaderFooterEntry->nAtom & 0xff);
6755 else
6756 xEntry->xString = rPersistEntry.xHeaderFooterEntry->pPlaceholder[nVal];
6757 }
6758 }
6759 break;
6760
6763 {
6764 xEntry.reset(new PPTFieldEntry);
6765 if ( aTextHd.nRecLen >= 4 )
6766 {
6767 rIn.ReadUInt16(xEntry->nPos)
6768 .ReadUInt16( nVal );
6769
6770 // evaluate ID
6771 //SvxFieldItem* pFieldItem = NULL;
6772 switch( aTextHd.nRecType )
6773 {
6775 xEntry->xField1.reset(new SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD));
6776 break;
6777
6779 {
6780 // Rude workaround for one special case reported
6781 // by a customer. (#i75203#)
6782
6783 // Don't even attempt to handle the general use
6784 // case for PPT_PST_RTFDateTimeMCAtom (a generic
6785 // MS style date/time format string). Just handle
6786 // the special case where the format string
6787 // contains only one or several possibly empty
6788 // quoted strings. I.e. something that doesn't
6789 // expand to any date or time at all, but to a
6790 // fixed string. How on earth somebody manages to
6791 // produce such things in PPT slides I have no
6792 // idea.
6793 if (nVal == 0)
6794 {
6795 OUStringBuffer aStr;
6796 bool inquote = false;
6797 for (int nLen = 0; nLen < 64; ++nLen)
6798 {
6799 sal_Unicode n(0);
6800 rIn.ReadUtf16( n );
6801
6802 // Collect quoted characters into aStr
6803 if ( n == '\'')
6804 inquote = !inquote;
6805 else if (!n)
6806 {
6807 // End of format string
6808 xEntry->xString = aStr.makeStringAndClear();
6809 break;
6810 }
6811 else if (!inquote)
6812 {
6813 // Non-quoted character, i.e. a real
6814 // format specifier. We don't handle
6815 // those. Sorry.
6816 break;
6817 }
6818 else
6819 {
6820 aStr.append(OUStringChar(n));
6821 }
6822 }
6823 }
6824 if (!xEntry->xString)
6825 {
6826 // Handle as previously
6827 xEntry->xField1.reset(new SvxFieldItem( SvxDateField( Date( Date::SYSTEM ), SvxDateType::Fix ), EE_FEATURE_FIELD ));
6828 }
6829 }
6830 }
6831 }
6832 }
6833 break;
6834
6836 {
6837 DffRecordHeader aHdInteractiveInfoAtom;
6838 if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_InteractiveInfoAtom, aTextHd.GetRecEndFilePos(), &aHdInteractiveInfoAtom ) )
6839 {
6840 PptInteractiveInfoAtom aInteractiveInfoAtom;
6841 ReadPptInteractiveInfoAtom( rIn, aInteractiveInfoAtom );
6842 for (const SdHyperlinkEntry& rHyperlink : rSdrPowerPointImport.m_aHyperList)
6843 {
6844 if ( rHyperlink.nIndex == aInteractiveInfoAtom.nExHyperlinkId )
6845 {
6846 if (!aTextHd.SeekToEndOfRecord(rIn))
6847 {
6848 break;
6849 }
6850 ReadDffRecordHeader( rIn, aTextHd );
6851 if ( aTextHd.nRecType != PPT_PST_TxInteractiveInfoAtom )
6852 {
6853 aTextHd.SeekToBegOfRecord( rIn );
6854 continue;
6855 }
6856 else
6857 {
6858 sal_uInt32 nStartPos, nEndPos;
6859 rIn.ReadUInt32( nStartPos )
6860 .ReadUInt32( nEndPos );
6861 if ( nEndPos )
6862 {
6863 xEntry.reset(new PPTFieldEntry);
6864 xEntry->nPos = static_cast<sal_uInt16>(nStartPos);
6865 xEntry->nTextRangeEnd = static_cast<sal_uInt16>(nEndPos);
6866 OUString aTarget( rHyperlink.aTarget );
6867 if ( !rHyperlink.aConvSubString.isEmpty() )
6868 {
6869 aTarget += "#" + rHyperlink.aConvSubString;
6870 }
6871 xEntry->xField1.reset(new SvxFieldItem( SvxURLField( aTarget, OUString(), SvxURLFormat::Repr ), EE_FEATURE_FIELD ));
6872 }
6873 }
6874 break;
6875 }
6876 }
6877 }
6878 }
6879 break;
6880 }
6881 if (!aTextHd.SeekToEndOfRecord(rIn))
6882 break;
6883 if (xEntry)
6884 {
6885 // sorting fields ( hi >> lo )
6886 auto it = std::find_if(FieldList.begin(), FieldList.end(),
6887 [&xEntry](const std::unique_ptr<PPTFieldEntry>& rxField) {
6888 return rxField->nPos < xEntry->nPos; });
6889 if ( it != FieldList.end() ) {
6890 FieldList.insert(it, std::move(xEntry));
6891 } else {
6892 FieldList.push_back( std::move(xEntry));
6893 }
6894 }
6895 }
6896 if ( !FieldList.empty() )
6897 {
6898 auto FE = FieldList.begin();
6899 auto& aCharPropList = aStyleTextPropReader.aCharPropList;
6900
6901 sal_Int32 i = nParagraphs - 1;
6902 sal_Int32 n = aCharPropList.size() - 1;
6903
6904 // at this point we just have a list of textportions(aCharPropList)
6905 // the next while loop tries to resolve the list of fields(pFieldList)
6906 while( ( FE < FieldList.end() ) && ( n >= 0 ) && ( i >= 0 ) )
6907 {
6908 PPTCharPropSet* pSet = aCharPropList[n].get();
6909 OUString aString( pSet->maString );
6910 sal_uInt32 nCount = aString.getLength();
6911 sal_uInt32 nPos = pSet->mnOriginalTextPos + nCount;
6912 while ( ( FE < FieldList.end() ) && nCount-- )
6913 {
6914 nPos--;
6915 FE = std::find_if(FE, FieldList.end(),
6916 [&nPos](const std::unique_ptr<PPTFieldEntry>& rxField) {return rxField->nPos <= nPos;});
6917 if (FE == FieldList.end())
6918 break;
6919
6920 if ( (*FE)->nPos == nPos )
6921 {
6922 if ( aString[nCount] == 0x2a )
6923 {
6924 sal_uInt32 nBehind = aString.getLength() - ( nCount + 1 );
6925 pSet->maString.clear();
6926 if ( nBehind )
6927 {
6928 PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
6929 pNewCPS->maString = aString.copy( nCount + 1, nBehind );
6930 aCharPropList.emplace( aCharPropList.begin() + n + 1, pNewCPS );
6931 }
6932 if ( (*FE)->xField2 )
6933 {
6934 PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
6935 pNewCPS->mpFieldItem = std::move((*FE)->xField2);
6936 aCharPropList.emplace( aCharPropList.begin() + n + 1, pNewCPS );
6937
6938 pNewCPS = new PPTCharPropSet( *pSet );
6939 pNewCPS->maString = " ";
6940 aCharPropList.emplace( aCharPropList.begin() + n + 1, pNewCPS );
6941 }
6942 if ( nCount )
6943 {
6944 PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
6945 pNewCPS->maString = aString.copy( 0, nCount );
6946 aCharPropList.emplace( aCharPropList.begin() + n++, pNewCPS );
6947 }
6948 if ( (*FE)->xField1 )
6949 {
6950 pSet->mpFieldItem = std::move((*FE)->xField1);
6951 }
6952 else if ( (*FE)->xString )
6953 pSet->maString = *(*FE)->xString;
6954 }
6955 else
6956 {
6957 if ( (*FE)->nTextRangeEnd ) // text range hyperlink
6958 {
6959 sal_uInt32 nHyperLen = (*FE)->nTextRangeEnd - nPos;
6960 if ( nHyperLen )
6961 {
6962 PPTCharPropSet* pBefCPS = nullptr;
6963 if ( nCount )
6964 {
6965 pBefCPS = new PPTCharPropSet( *pSet );
6966 pSet->maString = pSet->maString.copy(nCount);
6967 }
6968 sal_uInt32 nIdx = n;
6969 sal_Int32 nHyperLenLeft = nHyperLen;
6970
6971 while ( ( aCharPropList.size() > nIdx ) && nHyperLenLeft )
6972 {
6973 // the textrange hyperlink can take more than 1 paragraph
6974 // the solution here is to clone the hyperlink...
6975
6976 PPTCharPropSet* pCurrent = aCharPropList[ nIdx ].get();
6977 sal_Int32 nNextStringLen = pCurrent->maString.getLength();
6978
6979 DBG_ASSERT( (*FE)->xField1, "missing field!" );
6980 if (!(*FE)->xField1)
6981 break;
6982
6983 const SvxURLField* pField = static_cast<const SvxURLField*>((*FE)->xField1->GetField());
6984
6985 pCurrent->mbIsHyperlink = true;
6986 pCurrent->mnHylinkOrigColor = pCurrent->mpImplPPTCharPropSet->mnColor;
6987 pCurrent->mbHardHylinkOrigColor = ( ( pCurrent->mpImplPPTCharPropSet->mnAttrSet >>PPT_CharAttr_FontColor ) & 1)>0;
6988
6989 // add missing attribute to show underline property
6990 pCurrent->mpImplPPTCharPropSet->mnAttrSet |= 1 << PPT_CharAttr_Underline;
6991 pCurrent->mpImplPPTCharPropSet->mnFlags = 1 << PPT_CharAttr_Underline;
6992
6993 if ( pCurrent->mpFieldItem )
6994 {
6996 if ( dynamic_cast< const SvxURLField* >(pCurrent->mpFieldItem->GetField()) != nullptr)
6997 break;
6998 nHyperLenLeft--;
6999 }
7000 else if ( nNextStringLen )
7001 {
7002 if ( nNextStringLen <= nHyperLenLeft )
7003 {
7004 pCurrent->mpFieldItem.reset( new SvxFieldItem( SvxURLField( pField->GetURL(), pCurrent->maString, SvxURLFormat::Repr ), EE_FEATURE_FIELD ) );
7005 nHyperLenLeft -= nNextStringLen;
7006
7007 if ( nHyperLenLeft )
7008 {
7009 // if the next portion is in a higher paragraph,
7010 // the textrange is to decrease (because of the LineBreak character)
7011 if ( aCharPropList.size() > ( nIdx + 1 ) )
7012 {
7013 PPTCharPropSet* pNext = aCharPropList[ nIdx + 1 ].get();
7014 if ( pNext->mnParagraph > pCurrent->mnParagraph )
7015 nHyperLenLeft--;
7016 }
7017 }
7018 }
7019 else
7020 {
7021 PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pCurrent );
7022 pNewCPS->maString = pCurrent->maString.copy( nHyperLenLeft,( nNextStringLen - nHyperLenLeft ) );
7023 aCharPropList.emplace( aCharPropList.begin() + nIdx + 1, pNewCPS );
7024 OUString aRepresentation = pCurrent->maString.copy( 0, nHyperLenLeft );
7025 pCurrent->mpFieldItem.reset( new SvxFieldItem( SvxURLField( pField->GetURL(), aRepresentation, SvxURLFormat::Repr ), EE_FEATURE_FIELD ) );
7026 nHyperLenLeft = 0;
7027 }
7028 pCurrent->maString.clear();
7030 }
7031 nIdx++;
7032 }
7033 (*FE)->xField1.reset();
7034
7035 if ( pBefCPS )
7036 {
7037 pBefCPS->maString = aString.copy( 0, nCount );
7038 aCharPropList.emplace( aCharPropList.begin() + n, pBefCPS );
7039 n++;
7040 }
7041 }
7042 }
7043 }
7044 break;
7045 }
7046 }
7047 n--;
7048 }
7049 }
7050 mxImplTextObj->maParagraphList.resize( nParagraphs );
7051 for (size_t nCurCharPos = 0, nCurPos = 0;
7052 nCurPos < aStyleTextPropReader.aParaPropList.size();
7053 ++nCurPos)
7054 {
7055 mxImplTextObj->maParagraphList[ nCurPos ].reset(
7056 new PPTParagraphObj(
7057 aStyleTextPropReader, nCurPos, nCurCharPos,
7058 *rSdrPowerPointImport.m_pPPTStyleSheet,
7059 nInstance, aTextRulerInterpreter ) );
7060
7061 sal_uInt32 nParaAdjust, nFlags = 0;
7062 mxImplTextObj->maParagraphList[ nCurPos ]->GetAttrib( PPT_ParaAttr_Adjust, nParaAdjust, GetInstance() );
7063
7064 switch ( nParaAdjust )
7065 {
7066 case 0 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT; break;
7067 case 1 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER; break;
7068 case 2 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT; break;
7069 case 3 : nFlags = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK; break;
7070 }
7071 mxImplTextObj->mnTextFlags |= nFlags;
7072 }
7073}
7074
7076{
7077 mxImplTextObj = rTextObj.mxImplTextObj;
7078}
7079
7081{
7082}
7083
7085{
7086 mxImplTextObj->mnCurrentObject = 0;
7087 if ( !mxImplTextObj->mnParagraphCount )
7088 return nullptr;
7089 return mxImplTextObj->maParagraphList[ 0 ].get();
7090}
7091
7093{
7094 sal_uInt32 i = mxImplTextObj->mnCurrentObject + 1;
7095 if ( i >= mxImplTextObj->mnParagraphCount )
7096 return nullptr;
7097 mxImplTextObj->mnCurrentObject++;
7098 return mxImplTextObj->maParagraphList[ i ].get();
7099}
7100
7102{
7103 if ( mxImplTextObj->mrPersistEntry.pBObj )
7104 return &mxImplTextObj->mrPersistEntry.pBObj->GetMergedItemSet();
7105 else
7106 return nullptr;
7107}
7108
7110{
7111 if ( this != &rTextObj )
7112 {
7113 mxImplTextObj = rTextObj.mxImplTextObj;
7114 }
7115 return *this;
7116}
7117
7118static bool IsLine( const SdrObject* pObj )
7119{
7120 auto pSdrPathObj = dynamic_cast< const SdrPathObj* >(pObj);
7121 return pSdrPathObj && pSdrPathObj->IsLine() && pSdrPathObj->GetPointCount() == 2;
7122}
7123
7125 sal_Int32& nTableIndex, sal_Int32& nRow, sal_Int32& nRowCount, sal_Int32& nColumn, sal_Int32& nColumnCount )
7126{
7127 tools::Rectangle aSnapRect( pObj->GetSnapRect() );
7128 bool bCellObject = ( aSnapRect.GetWidth() > 1 ) && ( aSnapRect.GetHeight() > 1 );
7129 if ( bCellObject )
7130 {
7131 auto aRowIter = rRows.find( aSnapRect.Top() );
7132 auto aColumnIter = rColumns.find( aSnapRect.Left() );
7133 if ( ( aRowIter == rRows.end() ) || ( aColumnIter == rColumns.end() ) )
7134 bCellObject = false;
7135 else
7136 {
7137 nRowCount = 1;
7138 nRow = std::distance( rRows.begin(), aRowIter );
7139 while( ++aRowIter != rRows.end() )
7140 {
7141 if ( *aRowIter >= aSnapRect.Bottom() )
7142 break;
7143 nRowCount++;
7144 }
7145 nColumnCount = 1;
7146 nColumn = std::distance( rColumns.begin(), aColumnIter );
7147 while( ++aColumnIter != rColumns.end() )
7148 {
7149 if ( *aColumnIter >= aSnapRect.Right() )
7150 break;
7151 nColumnCount++;
7152 }
7153 nTableIndex = nRow * rColumns.size() + nColumn;
7154 }
7155 }
7156 return bCellObject;
7157}
7158
7159#define LinePositionLeft 0x01000000
7160#define LinePositionTop 0x02000000
7161#define LinePositionRight 0x04000000
7162#define LinePositionBottom 0x08000000
7163#define LinePositionTLBR 0x10000000
7164#define LinePositionBLTR 0x20000000
7165
7166
7167static void GetRowPositions( const tools::Rectangle& rSnapRect, const o3tl::sorted_vector< sal_Int32 >& rRows,
7168 const o3tl::sorted_vector< sal_Int32 >& rColumns, std::vector< sal_Int32 >& rPositions, sal_Int32 nColumn, sal_Int32 nFlags )
7169{
7170 auto aRow = rRows.find( rSnapRect.Top() );
7171 if ( aRow == rRows.end() )
7172 return;
7173
7174 sal_Int32 nRow = std::distance( rRows.begin(), aRow );
7175 while( ( aRow != rRows.end() ) && ((*aRow) < rSnapRect.Bottom() ) )
7176 {
7177 if ( nFlags & LinePositionLeft )
7178 rPositions.push_back( ( ( nRow * rColumns.size() ) + nColumn ) | LinePositionLeft );
7179 if ( nFlags & LinePositionRight )
7180 rPositions.push_back( ( ( nRow * rColumns.size() ) + ( nColumn - 1 ) ) | LinePositionRight );
7181
7182 ++nRow;
7183 ++aRow;
7184 }
7185}
7186
7187
7188static void GetColumnPositions( const tools::Rectangle& rSnapRect,
7189 const o3tl::sorted_vector< sal_Int32 >& rColumns, std::vector< sal_Int32 >& rPositions, sal_Int32 nRow, sal_Int32 nFlags )
7190{
7191 auto aColumn = rColumns.find( rSnapRect.Left() );
7192 if ( aColumn == rColumns.end() )
7193 return;
7194
7195 sal_Int32 nColumn = std::distance( rColumns.begin(), aColumn );
7196 while( ( aColumn != rColumns.end() ) && ((*aColumn) < rSnapRect.Right() ) )
7197 {
7198 if ( nFlags & LinePositionTop )
7199 rPositions.push_back( ( ( nRow * rColumns.size() ) + nColumn ) | LinePositionTop );
7200 if ( nFlags & LinePositionBottom )
7201 rPositions.push_back( ( ( ( nRow - 1 ) * rColumns.size() ) + nColumn ) | LinePositionBottom );
7202
7203 ++nColumn;
7204 ++aColumn;
7205 }
7206}
7207
7209 std::vector< sal_Int32 >& rPositions, const tools::Rectangle& rGroupSnap )
7210{
7211 tools::Rectangle aSnapRect( pObj->GetSnapRect() );
7212 if ( aSnapRect.Left() == aSnapRect.Right() )
7213 {
7214 auto aColumn = rColumns.find( aSnapRect.Left() );
7215 if ( ( aColumn != rColumns.end() ) || ( aSnapRect.Left() == rGroupSnap.Right() ) )
7216 {
7217 sal_Int32 nColumn, nFlags;
7218 if ( aColumn != rColumns.end() )
7219 {
7220 nColumn = std::distance( rColumns.begin(), aColumn );
7221 nFlags = LinePositionLeft;
7222 if ( aColumn != rColumns.begin() )
7223 nFlags |= LinePositionRight;
7224 }
7225 else
7226 {
7227 nColumn = rColumns.size();
7228 nFlags = LinePositionRight;
7229 }
7230 GetRowPositions( aSnapRect, rRows, rColumns, rPositions, nColumn, nFlags );
7231 }
7232 }
7233 else if ( aSnapRect.Top() == aSnapRect.Bottom() )
7234 {
7235 auto aRow = rRows.find( aSnapRect.Top() );
7236 if ( ( aRow != rRows.end() ) || ( aSnapRect.Top() == rGroupSnap.Bottom() ) )
7237 {
7238 sal_Int32 nRow, nFlags;
7239 if ( aRow != rRows.end() )
7240 {
7241 nRow = std::distance( rRows.begin(), aRow );
7242 nFlags = LinePositionTop;
7243 if ( aRow != rRows.begin() )
7244 nFlags |= LinePositionBottom;
7245 }
7246 else
7247 {
7248 nRow = rRows.size();
7249 nFlags = LinePositionBottom;
7250 }
7251 GetColumnPositions( aSnapRect, rColumns, rPositions, nRow, nFlags );
7252 }
7253 }
7254 else
7255 {
7256 sal_uInt32 nPosition = 0;
7257 Point aPt1( static_cast<const SdrPathObj*>(pObj)->GetPoint( 0 ) );
7258 Point aPt2( static_cast<const SdrPathObj*>(pObj)->GetPoint( 1 ) );
7259 if ( aPt1.X() < aPt2.X() )
7260 nPosition |= aPt1.Y() < aPt2.Y() ? LinePositionTLBR : LinePositionBLTR;
7261 else
7262 nPosition |= aPt1.Y() < aPt2.Y() ? LinePositionBLTR : LinePositionTLBR;
7263
7264 auto aRow = rRows.find( std::min(aPt1.Y(), aPt2.Y() ) );
7265 auto aColumn = rColumns.find( std::min(aPt1.X(), aPt2.X() ) );
7266 if ( ( aRow != rRows.end() ) && ( aColumn != rColumns.end() ) )
7267 {
7268 nPosition |= ( std::distance( rRows.begin(), aRow ) * rColumns.size() ) + std::distance( rColumns.begin(), aColumn );
7269 rPositions.push_back( nPosition );
7270 }
7271 }
7272}
7273
7274static void CreateTableRows( const Reference< XTableRows >& xTableRows, const o3tl::sorted_vector< sal_Int32 >& rRows, sal_Int32 nTableBottom )
7275{
7276 if ( rRows.size() > 1 )
7277 xTableRows->insertByIndex( 0, rRows.size() - 1 );
7278
7279 auto aIter = rRows.begin();
7280 sal_Int32 nLastPosition( *aIter );
7281 for ( sal_Int32 n = 0; n < xTableRows->getCount(); n++ )
7282 {
7283 sal_Int32 nHeight;
7284 if ( ++aIter != rRows.end() )
7285 {
7286 if (o3tl::checked_sub<sal_Int32>(*aIter, nLastPosition, nHeight))
7287 throw lang::IllegalArgumentException();
7288 nLastPosition = *aIter;
7289 }
7290 else
7291 {
7292 if (o3tl::checked_sub<sal_Int32>(nTableBottom, nLastPosition, nHeight))
7293 throw lang::IllegalArgumentException();
7294 }
7295
7296 Reference< XPropertySet > xPropSet( xTableRows->getByIndex( n ), UNO_QUERY_THROW );
7297 xPropSet->setPropertyValue( "Height", Any( nHeight ) );
7298 }
7299}
7300
7301static void CreateTableColumns( const Reference< XTableColumns >& xTableColumns, const o3tl::sorted_vector< sal_Int32 >& rColumns, sal_Int32 nTableRight )
7302{
7303 if ( rColumns.size() > 1 )
7304 xTableColumns->insertByIndex( 0, rColumns.size() - 1 );
7305
7306 auto aIter = rColumns.begin();
7307 sal_Int32 nLastPosition( *aIter );
7308 for ( sal_Int32 n = 0; n < xTableColumns->getCount(); n++ )
7309 {
7310 sal_Int32 nWidth;
7311 if ( ++aIter != rColumns.end() )
7312 {
7313 if (o3tl::checked_sub<sal_Int32>(*aIter, nLastPosition, nWidth))
7314 throw lang::IllegalArgumentException();
7315 nLastPosition = *aIter;
7316 }
7317 else
7318 {
7319 if (o3tl::checked_sub<sal_Int32>(nTableRight, nLastPosition, nWidth))
7320 throw lang::IllegalArgumentException();
7321 }
7322
7323 Reference< XPropertySet > xPropSet( xTableColumns->getByIndex( n ), UNO_QUERY_THROW );
7324 xPropSet->setPropertyValue( "Width", Any( nWidth ) );
7325 }
7326}
7327
7328static void MergeCells( const Reference< XTable >& xTable, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan )
7329{
7330 DBG_ASSERT( (nColSpan > 1) || (nRowSpan > 1), "nonsense parameter!!" );
7331 DBG_ASSERT( (nCol >= 0) && (nCol < xTable->getColumnCount()) && (nRow >= 0) && (nRow < xTable->getRowCount()), "the cell does not exists!!" );
7332 DBG_ASSERT( (nColSpan >= 1) && ((nCol + nColSpan - 1) < xTable->getColumnCount()), "nColSpan botch!" );
7333 DBG_ASSERT( (nRowSpan >= 1) && ((nRow + nRowSpan - 1) < xTable->getRowCount()), "nRowSpan botch!" );
7334
7335 if( xTable.is() ) try
7336 {
7337 Reference< XMergeableCellRange > xRange( xTable->createCursorByRange( xTable->getCellRangeByPosition( nCol, nRow,nCol + nColSpan - 1, nRow + nRowSpan - 1 ) ), UNO_QUERY_THROW );
7338 if( xRange->isMergeable() )
7339 xRange->merge();
7340 }
7341 catch( const Exception& )
7342 {
7343 DBG_UNHANDLED_EXCEPTION("filter.ms");
7344 }
7345}
7346
7347static void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell > const & xCell )
7348{
7349 try
7350 {
7351 Reference< XPropertySet > xPropSet( xCell, UNO_QUERY_THROW );
7352
7353 const sal_Int32 nLeftDist(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST).GetValue());
7354 const sal_Int32 nRightDist(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST).GetValue());
7355 const sal_Int32 nUpperDist(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST).GetValue());
7356 const sal_Int32 nLowerDist(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST).GetValue());
7357 xPropSet->setPropertyValue( "TextUpperDistance", Any( nUpperDist ) );
7358 xPropSet->setPropertyValue( "TextRightDistance", Any( nRightDist ) );
7359 xPropSet->setPropertyValue( "TextLeftDistance", Any( nLeftDist ) );
7360 xPropSet->setPropertyValue( "TextLowerDistance", Any( nLowerDist ) );
7361
7362 const SdrTextVertAdjust eTextVertAdjust(pObj->GetMergedItem(SDRATTR_TEXT_VERTADJUST).GetValue());
7363 drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP );
7364 if ( eTextVertAdjust == SDRTEXTVERTADJUST_CENTER )
7365 eVA = drawing::TextVerticalAdjust_CENTER;
7366 else if ( eTextVertAdjust == SDRTEXTVERTADJUST_BOTTOM )
7367 eVA = drawing::TextVerticalAdjust_BOTTOM;
7368 xPropSet->setPropertyValue( "TextVerticalAdjust", Any( eVA ) );
7369
7370 //set textHorizontalAdjust and TextWritingMode attr
7371 const sal_Int32 eHA(pObj->GetMergedItem(SDRATTR_TEXT_HORZADJUST).GetValue());
7372 const SvxFrameDirection eDirection = pObj->GetMergedItem(EE_PARA_WRITINGDIR).GetValue();
7373 xPropSet->setPropertyValue( "TextHorizontalAdjust" , Any( eHA ) );
7374 if ( eDirection == SvxFrameDirection::Vertical_RL_TB )
7375 {//vertical writing
7376 xPropSet->setPropertyValue( "TextWritingMode" , Any( css::text::WritingMode_TB_RL ) );
7377 }
7378 drawing::FillStyle eFillStyle(pObj->GetMergedItem( XATTR_FILLSTYLE ).GetValue());
7379 css::drawing::FillStyle eFS( css::drawing::FillStyle_NONE );
7380 switch( eFillStyle )
7381 {
7382 case drawing::FillStyle_SOLID :
7383 {
7384 eFS = css::drawing::FillStyle_SOLID;
7385 Color aFillColor( pObj->GetMergedItem( XATTR_FILLCOLOR ).GetColorValue() );
7386 xPropSet->setPropertyValue( "FillColor", Any( aFillColor ) );
7387 }
7388 break;
7389 case drawing::FillStyle_GRADIENT :
7390 {
7391 eFS = css::drawing::FillStyle_GRADIENT;
7392 basegfx::BGradient aBGradient(pObj->GetMergedItem(XATTR_FILLGRADIENT).GetGradientValue());
7393
7394 css::awt::Gradient aGradient;
7395 aGradient.Style = aBGradient.GetGradientStyle();
7396 aGradient.StartColor = static_cast<sal_Int32>(Color(aBGradient.GetColorStops().front().getStopColor()));
7397 aGradient.EndColor = static_cast<sal_Int32>(Color(aBGradient.GetColorStops().back().getStopColor()));
7398 aGradient.Angle = static_cast<short>(aBGradient.GetAngle());
7399 aGradient.Border = aBGradient.GetBorder();
7400 aGradient.XOffset = aBGradient.GetXOffset();
7401 aGradient.YOffset = aBGradient.GetYOffset();
7402 aGradient.StartIntensity = aBGradient.GetStartIntens();
7403 aGradient.EndIntensity = aBGradient.GetEndIntens();
7404 aGradient.StepCount = aBGradient.GetSteps();
7405
7406 xPropSet->setPropertyValue( "FillGradient", Any( aGradient ) );
7407 }
7408 break;
7409 case drawing::FillStyle_HATCH :
7410 eFS = css::drawing::FillStyle_HATCH;
7411 break;
7412 case drawing::FillStyle_BITMAP :
7413 {
7414 eFS = css::drawing::FillStyle_BITMAP;
7415
7416 const XFillBitmapItem & rXFillBitmapItem(pObj->GetMergedItem( XATTR_FILLBITMAP ));
7417 uno::Reference<graphic::XGraphic> xGraphic = rXFillBitmapItem.GetGraphicObject().GetGraphic().GetXGraphic();
7418 uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
7419 xPropSet->setPropertyValue("FillBitmap", uno::Any(xBitmap));
7420
7421 const XFillBmpStretchItem & rStretchItem(pObj->GetMergedItem( XATTR_FILLBMP_STRETCH ));
7422 const XFillBmpTileItem & rTileItem(pObj->GetMergedItem( XATTR_FILLBMP_TILE ));
7423 if( rTileItem.GetValue() )
7424 xPropSet->setPropertyValue("FillBitmapMode", uno::Any(drawing::BitmapMode_REPEAT));
7425 else if( rStretchItem.GetValue() )
7426 xPropSet->setPropertyValue("FillBitmapMode", uno::Any(drawing::BitmapMode_STRETCH));
7427 else
7428 xPropSet->setPropertyValue("FillBitmapMode", uno::Any(drawing::BitmapMode_NO_REPEAT));
7429 }
7430 break;
7431 default:
7432 case drawing::FillStyle_NONE :
7433 eFS = css::drawing::FillStyle_NONE;
7434 break;
7435
7436 }
7437 xPropSet->setPropertyValue( "FillStyle", Any( eFS ) );
7438 if ( eFillStyle != drawing::FillStyle_NONE )
7439 {
7440 sal_Int16 nFillTransparence( pObj->GetMergedItem( XATTR_FILLTRANSPARENCE ).GetValue() );
7441 xPropSet->setPropertyValue( "FillTransparence", Any( nFillTransparence ) );
7442 }
7443 }
7444 catch( const Exception& )
7445 {
7446 }
7447}
7448
7449static void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable > const & xTable, const std::vector< sal_Int32 >& vPositions, sal_Int32 nColumns )
7450{
7451 try
7452 {
7453 drawing::LineStyle eLineStyle(pLine->GetMergedItem( XATTR_LINESTYLE ).GetValue());
7454 css::table::BorderLine2 aBorderLine;
7455 switch( eLineStyle )
7456 {
7457 case drawing::LineStyle_DASH :
7458 case drawing::LineStyle_SOLID :
7459 {
7460 Color aLineColor( pLine->GetMergedItem( XATTR_LINECOLOR ).GetColorValue() );
7461 aBorderLine.Color = sal_Int32(aLineColor);
7462 // Avoid width = 0, the min value should be 1.
7463 sal_Int32 nLineWidth = std::max(sal_Int32(1), pLine->GetMergedItem(XATTR_LINEWIDTH) .GetValue() / 4);
7464 aBorderLine.LineWidth = static_cast< sal_Int16 >( nLineWidth );
7465 aBorderLine.LineStyle = eLineStyle == drawing::LineStyle_SOLID ? table::BorderLineStyle::SOLID : table::BorderLineStyle::DASHED;
7466 }
7467 break;
7468 default:
7469 case drawing::LineStyle_NONE :
7470 {
7471 aBorderLine.LineWidth = 0;
7472 aBorderLine.LineStyle = table::BorderLineStyle::NONE;
7473 }
7474 break;
7475 }
7476 for (auto const& vPos : vPositions)
7477 {
7478 sal_Int32 nPosition = vPos & 0xffffff;
7479 sal_Int32 nFlags = vPos &~0xffffff;
7480 sal_Int32 nRow = nPosition / nColumns;
7481 sal_Int32 nColumn = nPosition - ( nRow * nColumns );
7482 Reference< XCell > xCell( xTable->getCellByPosition( nColumn, nRow ) );
7483 Reference< XPropertySet > xPropSet( xCell, UNO_QUERY_THROW );
7484
7485 if ( nFlags & LinePositionLeft )
7486 xPropSet->setPropertyValue( "LeftBorder", Any( aBorderLine ) );
7487 if ( nFlags & LinePositionTop )
7488 xPropSet->setPropertyValue( "TopBorder", Any( aBorderLine ) );
7489 if ( nFlags & LinePositionRight )
7490 xPropSet->setPropertyValue( "RightBorder", Any( aBorderLine ) );
7491 if ( nFlags & LinePositionBottom )
7492 xPropSet->setPropertyValue( "BottomBorder", Any( aBorderLine ) );
7493 if ( nFlags & LinePositionTLBR )
7494 xPropSet->setPropertyValue( "DiagonalTLBR", Any( true ) );
7495 if ( nFlags & LinePositionBLTR )
7496 xPropSet->setPropertyValue( "DiagonalBLTR", Any( true ) );
7497 }
7498 }
7499 catch( const Exception& )
7500 {
7501 }
7502}
7503
7505 SdrObject* pGroup, const sal_uInt32* pTableArry,
7506 SvxMSDffSolverContainer* pSolverContainer,
7507 std::vector<rtl::Reference<SdrObject>>& rBackgroundColoredObjects)
7508{
7509 rtl::Reference<SdrObject> pRet = pGroup;
7510
7511 sal_uInt32 nRows = pTableArry[ 1 ];
7512 if (!nRows)
7513 return pRet;
7514
7515 const SdrObjGroup* pObjGroup = dynamic_cast<const SdrObjGroup*>(pGroup);
7516 if (!pObjGroup)
7517 return pRet;
7518
7519 SdrObjList* pSubList(pObjGroup->GetSubList());
7520 if (!pSubList)
7521 return pRet;
7522
7525
7526 SdrObjListIter aGroupIter( pSubList, SdrIterMode::DeepNoGroups, false );
7527 while( aGroupIter.IsMore() )
7528 {
7529 const SdrObject* pObj( aGroupIter.Next() );
7530 if ( !IsLine( pObj ) )
7531 {
7532 tools::Rectangle aSnapRect( pObj->GetSnapRect() );
7533 aRows.insert( aSnapRect.Top() );
7534 aColumns.insert( aSnapRect.Left() );
7535 }
7536 }
7537
7538 if (aRows.empty())
7539 return pRet;
7540
7542 pTable->uno_lock();
7543 Reference< XTable > xTable( pTable->getTable() );
7544
7545 try
7546 {
7547 CreateTableRows( xTable->getRows(), aRows, pGroup->GetSnapRect().Bottom() );
7548 CreateTableColumns( xTable->getColumns(), aColumns, pGroup->GetSnapRect().Right() );
7549
7550 sal_Int32 nCellCount = aRows.size() * aColumns.size();
7551 std::unique_ptr<sal_Int32[]> pMergedCellIndexTable(new sal_Int32[ nCellCount ]);
7552 for ( sal_Int32 i = 0; i < nCellCount; i++ )
7553 pMergedCellIndexTable[ i ] = i;
7554
7555 aGroupIter.Reset();
7556 while( aGroupIter.IsMore() )
7557 {
7558 SdrObject* pObj( aGroupIter.Next() );
7559 if ( !IsLine( pObj ) )
7560 {
7561 sal_Int32 nTableIndex = 0;
7562 sal_Int32 nRow = 0;
7563 sal_Int32 nRowCount = 0;
7564 sal_Int32 nColumn = 0;
7565 sal_Int32 nColumnCount = 0;
7566 if ( GetCellPosition( pObj, aRows, aColumns, nTableIndex, nRow, nRowCount, nColumn, nColumnCount ) )
7567 {
7568 Reference< XCell > xCell( xTable->getCellByPosition( nColumn, nRow ) );
7569
7570 ApplyCellAttributes( pObj, xCell );
7571
7572 if ( ( nRowCount > 1 ) || ( nColumnCount > 1 ) ) // cell merging
7573 {
7574 MergeCells( xTable, nColumn, nRow, nColumnCount, nRowCount );
7575 for ( sal_Int32 nRowIter = 0; nRowIter < nRowCount; nRowIter++ )
7576 {
7577 for ( sal_Int32 nColumnIter = 0; nColumnIter < nColumnCount; nColumnIter++ )
7578 { // now set the correct index for the merged cell
7579 pMergedCellIndexTable[ ( ( nRow + nRowIter ) * aColumns.size() ) + nColumn + nColumnIter ] = nTableIndex;
7580 }
7581 }
7582 }
7583
7584 // applying text
7585 OutlinerParaObject* pParaObject = pObj->GetOutlinerParaObject();
7586 if ( pParaObject )
7587 {
7588 SdrText* pSdrText = pTable->getText( nTableIndex );
7589 if ( pSdrText )
7590 pSdrText->SetOutlinerParaObject(*pParaObject);
7591 }
7592 }
7593 }
7594 }
7595 aGroupIter.Reset();
7596 while( aGroupIter.IsMore() )
7597 {
7598 SdrObject* pObj( aGroupIter.Next() );
7599 if ( IsLine( pObj ) )
7600 {
7601 std::vector< sal_Int32 > vPositions; // containing cell indexes + cell position
7602 GetLinePositions( pObj, aRows, aColumns, vPositions, pGroup->GetSnapRect() );
7603
7604 // correcting merged cell position
7605 for (auto & vPos : vPositions)
7606 {
7607 sal_Int32 nOldPosition = vPos & 0xffff;
7608 sal_Int32 nOldFlags = vPos & 0xffff0000;
7609 sal_Int32 nNewPosition = pMergedCellIndexTable[ nOldPosition ] | nOldFlags;
7610 vPos = nNewPosition;
7611 }
7612 ApplyCellLineAttributes( pObj, xTable, vPositions, aColumns.size() );
7613 }
7614 }
7615 pMergedCellIndexTable.reset();
7616
7617 // we are replacing the whole group object by a single table object, so
7618 // possibly connections to the group object have to be removed.
7619 if ( pSolverContainer )
7620 {
7621 for (auto & pPtr : pSolverContainer->aCList)
7622 {
7623 // check connections to the group object
7624 if ( pPtr->pAObj == pGroup )
7625 pPtr->pAObj = nullptr;
7626 if ( pPtr->pBObj == pGroup )
7627 pPtr->pBObj = nullptr;
7628
7629 // check connections to all its subobjects
7630 SdrObjListIter aIter( *pGroup, SdrIterMode::DeepWithGroups );
7631 while( aIter.IsMore() )
7632 {
7633 SdrObject* pPartObj = aIter.Next();
7634 if ( pPtr->pAObj == pPartObj )
7635 pPtr->pAObj = nullptr;
7636 if ( pPtr->pBObj == pPartObj )
7637 pPtr->pBObj = nullptr;
7638 }
7639 //In MS, the one_row_one_col table is made up of five
7640 //shape,the connector is connected to some part of a
7641 //table. But for us, the connector is connected to the
7642 //whole group table,so the connector obj is a group
7643 //table when export by us. We should process this
7644 //situation when importing.
7645 if ( pPtr->pAObj == pGroup )
7646 pPtr->pAObj = pTable.get();
7647 if ( pPtr->pBObj == pGroup )
7648 pPtr->pBObj = pTable.get();
7649 }
7650 }
7651 pTable->uno_unlock();
7652 pTable->SetSnapRect( pGroup->GetSnapRect() );
7653 pRet = pTable;
7654
7655 //Remove Objects from shape map
7656 SdrObjListIter aIter( *pGroup, SdrIterMode::DeepWithGroups );
7657 while( aIter.IsMore() )
7658 {
7659 SdrObject* pPartObj = aIter.Next();
7660 removeShapeId(pPartObj);
7661 // ofz#41510 make sure rBackgroundColoredObjects doesn't contain deleted objects
7662 std::replace(rBackgroundColoredObjects.begin(), rBackgroundColoredObjects.end(), pPartObj, pRet.get());
7663 }
7664 }
7665 catch( const Exception& )
7666 {
7667 pTable->uno_unlock();
7668 pTable = nullptr;
7669 }
7670
7671 return pRet;
7672}
7673
7675{
7676 bool bVerticalText = false;
7678 {
7679 auto eTextFlow = GetPropertyValue(DFF_Prop_txflTextFlow, 0) & 0xFFFF;
7680 switch( eTextFlow )
7681 {
7682 case mso_txflTtoBA : // Top to Bottom @-font, above -> below
7683 case mso_txflTtoBN : // Top to Bottom non-@, above -> below
7684 case mso_txflVertN : // Vertical, non-@, above -> below
7685 bVerticalText = !bVerticalText;
7686 break;
7687 default: break;
7688 }
7689 }
7690
7691 return bVerticalText;
7692}
7693
7695{
7696 SdrTextVertAdjust eTVA;
7697 SdrTextHorzAdjust eTHA;
7698
7699 sal_uInt32 nTextFlags = rTextObj.GetTextFlags();
7700
7703
7704 if ( IsVerticalText() )
7705 {
7708
7709 // read text anchor
7711
7712 switch( eTextAnchor )
7713 {
7714 case mso_anchorTop:
7717 break;
7718
7719 case mso_anchorMiddle :
7722 break;
7723
7724 case mso_anchorBottom:
7727 break;
7728
7729 default:
7730 break;
7731 }
7732 // if there is a 100% use of following attributes, the textbox can been aligned also in vertical direction
7733 switch ( eTextAnchor )
7734 {
7738 {
7739 // check if it is sensible to use the centered alignment
7741 if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left or also right aligned paragraphs
7742 eTVA = SDRTEXTVERTADJUST_CENTER; // the text has to be displayed using the full width;
7743 }
7744 break;
7745
7746 default :
7747 {
7749 eTVA = SDRTEXTVERTADJUST_TOP;
7750 else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT )
7752 }
7753 break;
7754 }
7755 }
7756 else
7757 {
7760
7761 // read text anchor
7763
7764 switch( eTextAnchor )
7765 {
7766 case mso_anchorTop:
7768 eTVA = SDRTEXTVERTADJUST_TOP;
7769 break;
7770
7771 case mso_anchorMiddle :
7774 break;
7775
7776 case mso_anchorBottom:
7779 break;
7780
7781 default:
7782 break;
7783 }
7784
7785 // if there is a 100% usage of following attributes, the textbox can be aligned also in horizontal direction
7786 switch ( eTextAnchor )
7787 {
7791 {
7792 // check if it is sensible to use the centered alignment
7794 if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left or also right aligned paragraphs
7795 eTHA = SDRTEXTHORZADJUST_CENTER; // the text has to be displayed using the full width;
7796 }
7797 break;
7798
7799 default :
7800 {
7803 else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT )
7805 }
7806 break;
7807 }
7808 }
7809 rSet.Put( SdrTextVertAdjustItem( eTVA ) );
7810 rSet.Put( SdrTextHorzAdjustItem( eTHA ) );
7811}
7812
7813/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nLineWidth
sal_uInt8 * Scanline
constexpr auto convertMasterUnitToMm100(N n)
sal_Int32 mnDepth
GPOS_MM
static OutputDevice * GetDefaultDevice()
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Size GetSizePixel() const
sal_uInt8 GetBlue() const
void SetGreen(sal_uInt8 nGreen)
void SetRed(sal_uInt8 nRed)
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
void SetBlue(sal_uInt8 nBlue)
sal_uInt32 GetPropertyValue(sal_uInt32 nId, sal_uInt32 nDefault) const
bool IsProperty(sal_uInt32 nRecType) const
Definition: dffpropset.hxx:58
friend SvStream & ReadDffPropSet(SvStream &rIn, DffPropSet &rPropSet)
static sal_uLong SanitizeEndPos(SvStream &rIn, sal_uLong nEndRecPos)
Definition: svdfppt.cxx:697
bool SeekToContent(sal_uInt32 nRecType, SvStream &rSt) const
void ReadPropSet(SvStream &rIn, SvxMSDffClientData *pClientData) const
Definition: msdffimp.cxx:280
void ApplyAttributes(SvStream &rIn, SfxItemSet &rSet) const
Definition: msdffimp.cxx:2619
Degree100 mnFix16Angle
Definition: msdffimp.hxx:96
static Degree100 Fix16ToAngle(sal_Int32 nAngle)
Definition: msdffimp.cxx:400
sal_uLong GetRecEndFilePos() const
bool SeekToEndOfRecord(SvStream &rIn) const
sal_uLong GetRecBegFilePos() const
bool SeekToBegOfRecord(SvStream &rIn) const
sal_uInt16 nRecInstance
bool SeekToContent(SvStream &rIn) const
DffRecordHeader * GetRecordHeader(sal_uInt16 nRecType, DffSeekToContentMode eMode=SEEK_FROM_BEGINNING)
Definition: msdffimp.cxx:3098
DffRecordHeader * Prev()
Definition: msdffimp.cxx:3055
void Consume(SvStream &rIn, sal_uInt32 nStOfs=0)
Definition: msdffimp.cxx:2979
DffRecordHeader * Current()
Definition: msdffimp.cxx:3017
DffRecordList * pCList
Definition: msdffimp.hxx:382
bool SeekToContent(SvStream &rIn, sal_uInt16 nRecType, DffSeekToContentMode eMode=SEEK_FROM_BEGINNING)
Definition: msdffimp.cxx:3086
DffRecordHeader * Last()
Definition: msdffimp.cxx:3072
sal_Int32 GetNumerator() const
sal_Int32 GetDenominator() const
void ReplaceColors(const Color *pSearchColors, const Color *rReplaceColors, sal_uLong nColorCount)
const Graphic & GetGraphic() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
Size GetPrefSize() const
const GDIMetaFile & GetGDIMetaFile() const
GraphicType GetType() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
MapMode GetPrefMapMode() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
bool IsFontAvailable(std::u16string_view rFontName) const
const SdrPowerPointImport * mpPPTImporter
Definition: svdfppt.hxx:1280
PptPageKind ePageKind
Definition: svdfppt.hxx:1279
virtual void GetDrawPage() override
Definition: svdfppt.cxx:1748
virtual bool InsertControl(const css::uno::Reference< css::form::XFormComponent > &rFComp, const css::awt::Size &rSize, css::uno::Reference< css::drawing::XShape > *pShape, bool bFloatingCtrl) override
Definition: svdfppt.cxx:1696
bool ReadOCXStream(tools::SvRef< SotStorage > &rSrc1, css::uno::Reference< css::drawing::XShape > *pShapeRef)
Definition: svdfppt.cxx:1680
DffRecordManager aExtendedPresRules
Definition: svdfppt.hxx:735
::std::vector< std::unique_ptr< PPTBuGraEntry > > aBuGraList
Definition: svdfppt.hxx:731
bool GetGraphic(sal_uInt32 nInstance, Graphic &rGraphic) const
Definition: svdfppt.cxx:3216
o3tl::enumarray< TSS_Type, PPTExtParaSheet > aExtParaSheet
Definition: svdfppt.hxx:737
PPTExtParaProv(SdrPowerPointImport &rManager, SvStream &rSt, const DffRecordHeader *pMainMasterHd)
Definition: svdfppt.cxx:3243
PPTNumberFormatCreator(std::unique_ptr< PPTExtParaProv >)
Definition: svdfppt.cxx:3389
bool ImplGetExtNumberFormat(SdrPowerPointImport const &rMan, SvxNumberFormat &rNumberFormat, sal_uInt32 nLevel, TSS_Type nInstance, TSS_Type nInstanceInSheet, std::optional< sal_Int16 > &rStartNumbering, sal_uInt32 nFontHeight, PPTParagraphObj const *pPara)
Definition: svdfppt.cxx:3405
sal_uInt32 nBulletFont
Definition: svdfppt.hxx:812
std::unique_ptr< PPTExtParaProv > pExtParaProv
Definition: svdfppt.hxx:840
sal_uInt32 nBulletHeight
Definition: svdfppt.hxx:813
sal_uInt32 nBulletChar
Definition: svdfppt.hxx:811
sal_uInt32 nIsBullet
Definition: svdfppt.hxx:810
void GetNumberFormat(SdrPowerPointImport const &rMan, SvxNumberFormat &rNumberFormat, sal_uInt32 nLevel, const PPTParaLevel &rParaLevel, const PPTCharLevel &rCharLevel, TSS_Type nInstance)
Definition: svdfppt.cxx:3655
sal_uInt32 nBulletColor
Definition: svdfppt.hxx:814
void ImplGetNumberFormat(SdrPowerPointImport const &rMan, SvxNumberFormat &rNumberFormat)
Definition: svdfppt.cxx:3764
sal_uInt32 nBulletOfs
Definition: svdfppt.hxx:816
void AppendPortion(PPTPortionObj &rPortion)
Definition: svdfppt.cxx:5868
PPTPortionObj * First()
Definition: svdfppt.cxx:6361
const PPTStyleSheet & mrStyleSheet
Definition: svdfppt.hxx:1154
PPTParagraphObj(PPTParagraphObj const &)=delete
TSS_Type mnInstance
Definition: svdfppt.hxx:1155
PPTPortionObj * Next()
Definition: svdfppt.cxx:6369
void ApplyTo(SfxItemSet &rSet, std::optional< sal_Int16 > &rStartNumbering, SdrPowerPointImport const &rManager, TSS_Type nInstanceInSheet)
Definition: svdfppt.cxx:6162
bool GetAttrib(sal_uInt32 nAttr, sal_uInt32 &nVal, TSS_Type nInstanceInSheet)
Definition: svdfppt.cxx:5896
void UpdateBulletRelSize(sal_uInt32 &nBulletRelSize) const
Definition: svdfppt.cxx:5874
::std::vector< std::unique_ptr< PPTPortionObj > > m_PortionList
Definition: svdfppt.hxx:1161
sal_uInt32 mnCurrentObject
Definition: svdfppt.hxx:1160
sal_uInt32 GetTextSize()
Definition: svdfppt.cxx:6347
SvxFieldItem * GetTextField()
Definition: svdfppt.cxx:5807
const PPTStyleSheet & mrStyleSheet
Definition: svdfppt.hxx:1112
void ApplyTo(SfxItemSet &rSet, SdrPowerPointImport &rManager, TSS_Type nInstanceInSheet)
Definition: svdfppt.cxx:5579
bool GetAttrib(sal_uInt32 nAttr, sal_uInt32 &nVal, TSS_Type nInstanceInSheet) const
Definition: svdfppt.cxx:5472
sal_uInt32 mnDepth
Definition: svdfppt.hxx:1114
sal_uInt32 Count() const
Definition: svdfppt.hxx:1143
TSS_Type mnInstance
Definition: svdfppt.hxx:1113
PPTTextObj(SvStream &rSt, SdrPowerPointImport &, PptSlidePersistEntry &, DffObjData const *)
Definition: svdfppt.cxx:6442
void SetVertical(bool bVertical)
Definition: svdfppt.hxx:1261
PPTParagraphObj * First()
Definition: svdfppt.cxx:7084
bool GetVertical() const
Definition: svdfppt.hxx:1268
const std::optional< PptOEPlaceholderAtom > & GetOEPlaceHolderAtom() const
Definition: svdfppt.hxx:1259
PPTParagraphObj * Next()
Definition: svdfppt.cxx:7092
sal_uInt32 Count() const
Definition: svdfppt.hxx:1245
sal_uInt32 GetCurrentIndex() const
Definition: svdfppt.hxx:1244
rtl::Reference< ImplPPTTextObj > mxImplTextObj
Definition: svdfppt.hxx:1232
sal_uInt32 GetTextFlags() const
Definition: svdfppt.hxx:1260
void SetDestinationInstance(TSS_Type nInstance)
Definition: svdfppt.hxx:1256
const SfxItemSet * GetBackground() const
Definition: svdfppt.cxx:7101
TSS_Type GetInstance() const
Definition: svdfppt.hxx:1249
PPTTextObj & operator=(const PPTTextObj &rTextObj)
Definition: svdfppt.cxx:7109
TSS_Type GetDestinationInstance() const
Definition: svdfppt.hxx:1253
void SetInstance(TSS_Type nInstance)
Definition: svdfppt.hxx:1250
constexpr tools::Long Y() const
constexpr tools::Long X() const
bool is_null(size_t nIdx) const
Definition: svdfppt.hxx:406
void push_back(std::unique_ptr< PptSlidePersistEntry > pEntry)
Definition: svdfppt.hxx:415
sal_uInt16 FindPage(sal_uInt32 nId) const
Definition: svdfppt.cxx:210
Entries_t mvEntries
Definition: svdfppt.hxx:399
size_t size() const
Definition: svdfppt.hxx:405
virtual const PptSlideLayoutAtom * GetSlideLayoutAtom() const
Definition: svdfppt.cxx:520
std::optional< std::vector< PptFontEntityAtom > > m_xFonts
Definition: svdfppt.hxx:474
virtual SdrObject * ReadObjText(PPTTextObj *pTextObj, SdrObject *pObj, SdPageCapsule pPage) const
Definition: svdfppt.cxx:563
virtual rtl::Reference< SdrObject > ProcessObj(SvStream &rSt, DffObjData &rData, SvxMSDffClientData &rClientData, tools::Rectangle &rTextRect, SdrObject *pObj) override
Definition: svdfppt.cxx:731
SdrEscherImport(PowerPointImportParam &, const OUString &rBaseURL)
Definition: svdfppt.cxx:509
virtual bool GetColorFromPalette(sal_uInt16 nNum, Color &rColor) const override
Definition: svdfppt.cxx:546
virtual bool SeekToShape(SvStream &rSt, SvxMSDffClientData *pClientData, sal_uInt32 nId) const override
Definition: svdfppt.cxx:551
bool ReadString(OUString &rStr) const
Definition: svdfppt.cxx:525
PptDocumentAtom aDocAtom
Definition: svdfppt.hxx:469
DffRecordManager aDocRecManager
Definition: svdfppt.hxx:470
void RecolorGraphic(SvStream &rSt, sal_uInt32 nRecLen, Graphic &rGraph)
Definition: svdfppt.cxx:597
void ImportHeaderFooterContainer(DffRecordHeader const &rHeader, HeaderFooterEntry &rEntry)
Definition: svdfppt.cxx:3154
virtual void ProcessClientAnchor2(SvStream &rSt, DffRecordHeader &rHd, DffObjData &rObj) override
Definition: svdfppt.cxx:568
sal_uInt32 nStreamLen
Definition: svdfppt.hxx:476
PowerPointImportParam & rImportParam
Definition: svdfppt.hxx:485
virtual ~SdrEscherImport() override
Definition: svdfppt.cxx:516
::std::vector< PPTOleEntry > aOleObjectList
Definition: svdfppt.hxx:472
const PptFontEntityAtom * GetFontEnityAtom(sal_uInt32 nNum) const
Definition: svdfppt.cxx:556
MapUnit GetScaleUnit() const
virtual rtl::Reference< SdrPage > AllocPage(bool bMasterPage)
const SfxItemPool & GetItemPool() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
virtual SdrObjList * GetSubList() const override
SdrObject * Next()
bool IsMore() const
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
void SetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
virtual SdrInventor GetObjInventor() const
virtual OutlinerParaObject * GetOutlinerParaObject() const
virtual const tools::Rectangle & GetSnapRect() const
void SetMergedItem(const SfxPoolItem &rItem)
void PutItemSet(const SfxItemSet &rSet)
void ClearItem(const sal_uInt16 nWhich=0)
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
Size GetSize() const
sal_Int32 GetUpperBorder() const
sal_Int32 GetRightBorder() const
sal_Int32 GetLeftBorder() const
SdrPageProperties & getSdrPageProperties()
sal_Int32 GetLowerBorder() const
tools::Long GetHeight() const
tools::Long GetWidth() const
bool IsLine() const
std::unique_ptr< PptSlidePersistList > m_pSlidePages
Definition: svdfppt.hxx:579
sal_uInt16 GetMasterPageIndex(sal_uInt16 nPageNum, PptPageKind ePageKind=PPT_SLIDEPAGE) const
Definition: svdfppt.cxx:3026
virtual bool GetColorFromPalette(sal_uInt16 nNum, Color &rColor) const override
Definition: svdfppt.cxx:2547
sal_uLong m_nDocStreamPos
Definition: svdfppt.hxx:582
virtual SdrObject * ApplyTextObj(PPTTextObj *pTextObj, SdrTextObj *pText, SdPageCapsule pPage, SfxStyleSheet *, SfxStyleSheet **) const
Definition: svdfppt.cxx:2238
void ApplyTextAnchorAttributes(PPTTextObj const &rTextObj, SfxItemSet &rSet) const
Definition: svdfppt.cxx:7694
sal_uInt16 GetPageCount(PptPageKind eKind=PPT_SLIDEPAGE) const
Definition: svdfppt.cxx:2471
sal_uInt16 m_nCurrentPageNum
Definition: svdfppt.hxx:581
::std::vector< SdHyperlinkEntry > m_aHyperList
Definition: svdfppt.hxx:570
rtl::Reference< SdrPage > MakeBlankPage(bool bMaster) const
Definition: svdfppt.cxx:2672
virtual rtl::Reference< SdrObject > ImportOLE(sal_uInt32 nOLEId, const Graphic &rGraf, const tools::Rectangle &rBoundRect, const tools::Rectangle &rVisArea, const int _nCalledByGroup) const override
Definition: svdfppt.cxx:1798
const PPTStyleSheet * m_pPPTStyleSheet
Definition: svdfppt.hxx:575
bool SeekToCurrentPage(DffRecordHeader *pRecHd) const
Definition: svdfppt.cxx:2449
void ImportPage(SdrPage *pPage, const PptSlidePersistEntry *pMasterPersist)
Definition: svdfppt.cxx:2756
PptSlidePersistList * GetPageList(PptPageKind ePageKind) const
Definition: svdfppt.cxx:2204
virtual ~SdrPowerPointImport() override
Definition: svdfppt.cxx:1673
void SeekOle(SfxObjectShell *pShell, sal_uInt32 nFilterOptions)
Definition: svdfppt.cxx:2010
const PPTStyleSheet * m_pDefaultSheet
Definition: svdfppt.hxx:576
std::unique_ptr< sal_uInt32[]> m_pPersistPtr
Definition: svdfppt.hxx:572
virtual bool SeekToShape(SvStream &rSt, SvxMSDffClientData *pClientData, sal_uInt32 nId) const override
Definition: svdfppt.cxx:2606
PptUserEditAtom m_aUserEditAtom
Definition: svdfppt.hxx:568
static bool SeekToContentOfProgTag(sal_Int32 nVersion, SvStream &rSt, const DffRecordHeader &rProgTagBinaryDataHd, DffRecordHeader &rContentHd)
Definition: svdfppt.cxx:2391
PptColorSchemeAtom m_aPageColors
Definition: svdfppt.hxx:569
virtual const PptSlideLayoutAtom * GetSlideLayoutAtom() const override
Definition: svdfppt.cxx:2982
sal_uInt16 m_nPageColorsNum
Definition: svdfppt.hxx:583
sal_uInt32 GetCurrentPageId()
Definition: svdfppt.cxx:2441
std::unique_ptr< SvMemoryStream > ImportExOleObjStg(sal_uInt32 nPersistPtr, sal_uInt32 &nOleId) const
Definition: svdfppt.cxx:1979
sal_uInt32 GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const
Definition: svdfppt.cxx:3001
rtl::Reference< SdrObject > ImportPageBackgroundObject(const SdrPage &rPage, sal_uInt32 &nBgFileOffset)
Definition: svdfppt.cxx:3041
static SdrOutliner * GetDrawOutliner(SdrTextObj const *pSdrText)
Definition: svdfppt.cxx:2218
PptPageKind m_eCurrentPageKind
Definition: svdfppt.hxx:585
std::unique_ptr< PptSlidePersistList > m_pNotePages
Definition: svdfppt.hxx:580
virtual bool ReadFormControl(tools::SvRef< SotStorage > &rSrc1, css::uno::Reference< css::form::XFormComponent > &rFormComp) const =0
PptPageKind m_ePageColorsKind
Definition: svdfppt.hxx:584
rtl::Reference< SdrObject > CreateTable(SdrObject *pGroupObject, const sal_uInt32 *pTableArry, SvxMSDffSolverContainer *pSolverContainer, std::vector< rtl::Reference< SdrObject > > &rBackgroundColoredObjects)
Definition: svdfppt.cxx:7504
void SetPageNum(sal_uInt16 nPageNum, PptPageKind=PPT_SLIDEPAGE)
Definition: svdfppt.cxx:2479
bool SeekToDocument(DffRecordHeader *pRecHd) const
Definition: svdfppt.cxx:2371
bool IsVerticalText() const
Definition: svdfppt.cxx:7674
bool ReadFontCollection()
Definition: svdfppt.cxx:2155
Size GetPageSize() const
Definition: svdfppt.cxx:2517
sal_uInt32 m_nPersistPtrCnt
Definition: svdfppt.hxx:573
sal_uInt32 GetNotesPageId(sal_uInt16 nPageNum) const
Definition: svdfppt.cxx:3009
std::unique_ptr< PptSlidePersistList > m_pMasterPages
Definition: svdfppt.hxx:578
bool IsNoteOrHandout(sal_uInt16 nPageNum) const
Definition: svdfppt.cxx:2993
virtual SdrObject * ReadObjText(PPTTextObj *pTextObj, SdrObject *pObj, SdPageCapsule pPage) const override
Definition: svdfppt.cxx:2227
bool HasMasterPage(sal_uInt16 nPageNum, PptPageKind ePageKind=PPT_SLIDEPAGE) const
Definition: svdfppt.cxx:3017
SdrPowerPointImport(PowerPointImportParam &, const OUString &rBaseURL)
Definition: svdfppt.cxx:1308
SdrOutliner & ImpGetDrawOutliner() const
virtual const Size & GetTextSize() const
virtual SdrObjKind GetObjIdentifier() const override
virtual void SetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
css::uno::Reference< css::embed::XStorage > const & GetStorage()
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static SotStorage * OpenOLEStorage(css::uno::Reference< css::embed::XStorage > const &xStorage, OUString const &rEleName, StreamMode=StreamMode::STD_READWRITE)
const OUString & GetName() const
sal_uInt64 Tell() const
bool good() const
virtual sal_uInt64 TellEnd()
SvStream & ReadInt16(sal_Int16 &rInt16)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SvStream & ReadUtf16(sal_Unicode &rUtf16)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & ReadInt32(sal_Int32 &rInt32)
std::size_t ReadBytes(void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
ErrCode GetError() const
SvStream & ReadSChar(signed char &rChar)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt64 remainingSize()
SvStream & ReadUChar(unsigned char &rChar)
static OUString GetMSBasicStorageName()
Definition: svxmsbas2.cxx:75
void SetTextFirstLineOffsetValue(const short nValue)
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
void SetPropLineSpace(const sal_uInt16 nProp)
void SetInterLineSpaceRule(SvxInterLineSpaceRule e)
void SetLineSpaceRule(SvxLineSpaceRule e)
void SetLineHeight(const sal_uInt16 nHeight)
const css::uno::Reference< css::container::XIndexContainer > & GetFormComps()
Definition: msocximex.cxx:86
css::uno::Reference< css::frame::XModel > mxModel
Definition: msocximex.hxx:69
const css::uno::Reference< css::lang::XMultiServiceFactory > & GetServiceFactory()
Definition: msocximex.cxx:59
css::uno::Reference< css::drawing::XDrawPage > xDrawPage
Definition: msocximex.hxx:72
abstract base class for Escher imports
Definition: msdffimp.hxx:415
DffRecordManager maShapeRecords
Definition: msdffimp.hxx:553
SvStream & rStCtrl
Definition: msdffimp.hxx:444
sal_Int32 ScalePoint(sal_Int32 nVal) const
Definition: msdffimp.cxx:3213
sal_uInt32 nSvxMSDffOLEConvFlags
Definition: msdffimp.hxx:461
void Scale(sal_Int32 &rVal) const
Definition: msdffimp.cxx:3157
SdrModel * pSdrModel
Definition: msdffimp.hxx:447
bool GetBLIP(sal_uLong nIdx, Graphic &rData, tools::Rectangle *pVisArea=nullptr)
Request for a specific BLIP.
Definition: msdffimp.cxx:6430
tools::Long nMapMul
Definition: msdffimp.hxx:449
OUString maBaseURL
Definition: msdffimp.hxx:430
static void SolveSolver(const SvxMSDffSolverContainer &rSolver)
Create connections between shapes.
Definition: msdffimp.cxx:461
virtual bool SeekToShape(SvStream &rSt, SvxMSDffClientData *pClientData, sal_uInt32 nId) const
Definition: msdffimp.cxx:3280
sal_uInt32 mnIdClusters
Definition: msdffimp.hxx:431
void removeShapeId(SdrObject const *pShape)
Definition: msdffimp.cxx:7621
std::vector< FIDCL > maFidcls
Definition: msdffimp.hxx:432
static bool GetBLIPDirect(SvStream &rBLIPStream, Graphic &rData, tools::Rectangle *pVisArea=nullptr)
read a BLIP out of an already positioned stream
Definition: msdffimp.cxx:6514
Color MSO_CLR_ToColor(sal_uInt32 nColorCode, sal_uInt16 nContextProperty=DFF_Prop_lineColor) const
Definition: msdffimp.cxx:3444
tools::Long nMapDiv
Definition: msdffimp.hxx:450
void SetDgContainer(SvStream &rSt)
Definition: msdffimp.cxx:5858
bool SeekToRec2(sal_uInt16 nRecId1, sal_uInt16 nRecId2, sal_uLong nMaxFilePos) const
Definition: msdffimp.cxx:3379
static css::uno::Reference< css::embed::XEmbeddedObject > CheckForConvertToSOObj(sal_uInt32 nConvertFlags, SotStorage &rSrcStg, const css::uno::Reference< css::embed::XStorage > &xDestStg, const Graphic &rGrf, const tools::Rectangle &rVisArea, OUString const &rBaseURL)
Definition: msdffimp.cxx:7115
void ScaleEmu(sal_Int32 &rVal) const
Definition: msdffimp.cxx:3198
void insertShapeId(sal_Int32 nShapeId, SdrObject *pShape)
Definition: msdffimp.cxx:7616
rtl::Reference< SdrObject > ImportObj(SvStream &rSt, SvxMSDffClientData &rData, tools::Rectangle &rClientRect, const tools::Rectangle &rGlobalChildRect, int nCalledByGroup, sal_Int32 *pShapeId)
Definition: msdffimp.cxx:4118
static bool SeekToRec(SvStream &rSt, sal_uInt16 nRecId, sal_uLong nMaxFilePos, DffRecordHeader *pRecHd=nullptr, sal_uLong nSkipCount=0)
Definition: msdffimp.cxx:3335
static OUString MSDFFReadZString(SvStream &rIn, sal_uInt32 nMaxLen, bool bUniCode)
Definition: msdffimp.cxx:3768
Color MSO_TEXT_CLR_ToColor(sal_uInt32 nColorCode) const
Definition: msdffimp.cxx:3427
const SvxNumRule & GetNumRule() const
sal_uInt16 GetLevelCount() const
const SvxNumberFormat & GetLevel(sal_uInt16 nLevel) const
void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat &rFmt, bool bIsValid=true)
void SetStart(sal_uInt16 nSet)
void SetAbsLSpace(sal_Int32 nSet)
virtual void SetGraphicBrush(const SvxBrushItem *pBrushItem, const Size *pSize=nullptr, const sal_Int16 *pOrient=nullptr)
void SetFirstLineIndent(const tools::Long nFirstLineIndent)
void SetBulletFont(const vcl::Font *pFont)
void SetGraphicSize(const Size &rSet)
void SetCharTextDistance(short nSet)
void SetListFormat(const OUString &rPrefix, const OUString &rSuffix, int nLevel)
void SetBulletColor(Color nSet)
void SetBulletRelSize(sal_uInt16 nSet)
void SetIndentAt(const tools::Long nIndentAt)
void SetFirstLineOffset(sal_Int32 nSet)
void SetBulletChar(sal_UCS4 cSet)
void SetNumberingType(SvxNumType nSet)
SvxNumType GetNumberingType() const
bool Insert(const SvxTabStop &rTab)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
void SetPropUpper(const sal_uInt16 nU)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
void SetPropLower(const sal_uInt16 nL)
void SetUpperValue(const sal_uInt16 nU)
void SetLowerValue(const sal_uInt16 nL)
const OUString & GetURL() const
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
const Color & GetColorValue() const
const GraphicObject & GetGraphicObject() const
const basegfx::BGradient & GetGradientValue() const
tools::Long Decompress(SvStream &rIStm, SvStream &rOStm)
tools::Long EndCompression()
void BeginCompression(int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false)
sal_uInt16 GetBorder() const
sal_uInt16 GetStartIntens() const
sal_uInt16 GetSteps() const
sal_uInt16 GetXOffset() const
const basegfx::BColorStops & GetColorStops() const
sal_uInt16 GetEndIntens() const
Degree10 GetAngle() const
css::awt::GradientStyle GetGradientStyle() const
sal_uInt16 GetYOffset() const
const_iterator begin() const
const_iterator find(const Value &x) const
bool empty() const
const_iterator end() const
size_type size() const
std::pair< const_iterator, bool > insert(Value &&x)
void SetGraphic(const Graphic &rGraphic, const OUString &rMediaType)
constexpr Point Center() const
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr Size GetSize() const
constexpr tools::Long Right() const
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
T * get() const
bool is() const
static const sal_Int64 nanoPerMilli
SvStream * GetStream(StreamMode eMode)
void SetPitch(FontPitch ePitch)
void SetColor(const Color &)
void SetFontHeight(tools::Long nHeight)
void SetFamily(FontFamily)
void SetCharSet(rtl_TextEncoding)
void SetFamilyName(const OUString &rFamilyName)
rtl_TextEncoding GetCharSet() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
int nCount
const char * pS
FormulaCommand pE
#define DBG_ASSERT(sCon, aError)
bool ReadDffRecordHeader(SvStream &rIn, DffRecordHeader &rRec)
#define DBG_UNHANDLED_EXCEPTION(...)
float u
constexpr TypedWhichId< SvxHangingPunctuationItem > EE_PARA_HANGINGPUNCTUATION(EE_PARA_START+2)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr TypedWhichId< SfxBoolItem > EE_PARA_BULLETSTATE(EE_PARA_START+9)
constexpr TypedWhichId< SvxTabStopItem > EE_PARA_TABS(EE_PARA_START+17)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
constexpr TypedWhichId< SvxULSpaceItem > EE_PARA_ULSPACE(EE_PARA_START+14)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxLRSpaceItem > EE_PARA_LRSPACE(EE_PARA_START+13)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr TypedWhichId< SvxForbiddenRuleItem > EE_PARA_FORBIDDENRULES(EE_PARA_START+3)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr TypedWhichId< SvxLineSpacingItem > EE_PARA_SBL(EE_PARA_START+15)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
constexpr TypedWhichId< SfxInt16Item > EE_PARA_OUTLLEVEL(EE_PARA_START+11)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvxNumBulletItem > EE_PARA_NUMBULLET(EE_PARA_START+5)
constexpr TypedWhichId< SvxCharReliefItem > EE_CHAR_RELIEF(EE_CHAR_START+26)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
EmbeddedObjectRef * pObject
#define ERRCODE_NONE
#define DFLT_ESC_PROP
ShapeFlag
Definition: escherex.hxx:85
sal_Int16 nVersion
Reference< XInterface > xTarget
SvxTimeFormat
SvxDateFormat
sal_Int16 nValue
LINESTYLE_SINGLE
LINESTYLE_NONE
STRIKEOUT_SINGLE
STRIKEOUT_NONE
PITCH_VARIABLE
PITCH_FIXED
ITALIC_NORMAL
ITALIC_NONE
FAMILY_DECORATIVE
FAMILY_DONTKNOW
FAMILY_SCRIPT
FAMILY_SWISS
FAMILY_MODERN
FAMILY_ROMAN
WEIGHT_BOLD
WEIGHT_NORMAL
SvxFrameDirection
sal_Int32 nIndex
sal_Int64 n
#define LANGUAGE_SYSTEM
#define LANGUAGE_PROCESS_OR_USER_DEFAULT
sal_uInt16 nPos
sal_Int32 nFirstLineOffset
#define SAL_WARN(area, stream)
MapUnit
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
aStr
aBuf
#define DFF_Prop_tableProperties
#define DFF_Prop_cdirFont
#define DFF_msofbtClientTextbox
#define DFF_Prop_txflTextFlow
#define DFF_Prop_FitTextToShape
#define DFF_msofbtDg
#define DFF_Prop_WrapText
#define DFF_Prop_fNoFillHitTest
#define DFF_msofbtOPT
#define DFF_Prop_anchorText
#define DFF_Prop_Rotation
#define DFF_msofbtClientData
#define DFF_Prop_dxTextRight
#define DFF_Prop_dyTextTop
#define DFF_COMMON_RECORD_HEADER_SIZE
#define DFF_Prop_dyTextBottom
#define DFF_Prop_tableRowProperties
#define DFF_Prop_fillBlip
#define DFF_Prop_dxTextLeft
#define DFF_msofbtSp
mso_cdir0
#define DFF_msofbtDgContainer
#define DFF_PST_ExOleObjStg
mso_sptMin
#define DFF_msofbtSolverContainer
#define DFF_PSFLAG_CONTAINER
#define DFF_msofbtSpContainer
mso_wrapNone
mso_wrapSquare
#define DFF_Prop_hspMaster
mso_fillShade
mso_fillShadeCenter
mso_fillSolid
mso_fillBackground
mso_fillTexture
mso_fillShadeShape
mso_fillShadeScale
mso_fillShadeTitle
mso_fillPattern
#define DFF_msofbtSpgrContainer
#define DFF_Prop_fillType
#define DFF_msofbtUDefProp
#define DFF_Prop_fillColor
#define DFF_Prop_fillBackColor
mso_txflTtoBN
mso_txflBtoT
mso_txflVertN
mso_txflTtoBA
mso_anchorTop
mso_anchorBottomCenteredBaseline
mso_anchorBottomCentered
mso_anchorTopCentered
mso_anchorBottomBaseline
mso_anchorTopBaseline
mso_anchorMiddleCentered
mso_anchorMiddle
mso_anchorTopCenteredBaseline
mso_anchorBottom
SvStream & ReadSvxMSDffSolverContainer(SvStream &rIn, SvxMSDffSolverContainer &rContainer)
Definition: msdffimp.cxx:436
@ SEEK_FROM_CURRENT
Definition: msdffimp.hxx:375
@ SEEK_FROM_CURRENT_AND_RESTART
Definition: msdffimp.hxx:376
@ table
size
@ Exception
Shape IDs per cluster in DGG atom.
int i
Definition: gentoken.py:48
string t
Definition: gentoken.py:33
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
#define SVX_MAX_NUM
SvxNumRuleType
sal_Int16 nId
QPRO_FUNC_TYPE nType
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
SdrOnOffItem makeSdrTextWordWrapItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
SdrTextVertAdjust
SDRTEXTVERTADJUST_BOTTOM
SDRTEXTVERTADJUST_BLOCK
SDRTEXTVERTADJUST_CENTER
SDRTEXTVERTADJUST_TOP
SdrTextHorzAdjust
SDRTEXTHORZADJUST_LEFT
SDRTEXTHORZADJUST_BLOCK
SDRTEXTHORZADJUST_CENTER
SDRTEXTHORZADJUST_RIGHT
SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextMinFrameHeightItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextMinFrameWidthItem(tools::Long mnWidth)
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
std::vector< SvStorageInfo > SvStorageInfoList
TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString(SvStream &rStrm, std::size_t nUnits)
TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset)
const DffRecordHeader & rSpHd
Definition: msdffimp.hxx:301
sal_uInt32 nShapeId
Definition: msdffimp.hxx:306
tools::Rectangle aChildAnchor
Definition: msdffimp.hxx:304
ShapeFlag nSpFlags
Definition: msdffimp.hxx:307
MSO_SPT eShapeType
Definition: msdffimp.hxx:308
tools::Rectangle aBoundRect
Definition: msdffimp.hxx:303
bool bShapeType
Definition: msdffimp.hxx:310
bool bChildAnchor
Definition: msdffimp.hxx:313
sal_uInt32 nCurrent
Definition: msdffimp.hxx:361
sal_Int32 nEndPos
sal_Int32 nStartPos
sal_uInt32 IsToDisplay(sal_uInt32 nInstance)
Definition: svdfppt.cxx:3121
sal_uInt32 nAtom
Definition: svdfppt.hxx:530
OUString pPlaceholder[4]
Definition: svdfppt.hxx:529
sal_uInt32 NeedToImportInstance(const sal_uInt32 nInstance, const PptSlidePersistEntry &rSlidePersist)
Definition: svdfppt.cxx:3138
HeaderFooterEntry(const PptSlidePersistEntry *pMaster=nullptr)
Definition: svdfppt.cxx:3103
const PptSlidePersistEntry * pMasterPersist
Definition: svdfppt.hxx:528
sal_uInt16 mnSymbolFont
Definition: svdfppt.hxx:929
sal_uInt16 mnFontHeight
Definition: svdfppt.hxx:927
sal_uInt16 mnFlags
Definition: svdfppt.hxx:922
sal_uInt16 mnANSITypeface
Definition: svdfppt.hxx:926
sal_uInt16 mnAsianOrComplexFont
Definition: svdfppt.hxx:925
sal_uInt16 mnEscapement
Definition: svdfppt.hxx:928
sal_uInt32 mnColor
Definition: svdfppt.hxx:923
sal_uInt16 mnFont
Definition: svdfppt.hxx:924
sal_uInt32 mnAttrSet
Definition: svdfppt.hxx:921
sal_uInt32 mnAttrSet
Definition: svdfppt.hxx:880
sal_uInt16 mpArry[22]
Definition: svdfppt.hxx:882
sal_uInt32 mnBulletColor
Definition: svdfppt.hxx:881
Graphic aBuGra
Definition: svdfppt.hxx:724
PPTBuGraEntry(Graphic aGraphic, sal_uInt32 nInstance)
Definition: svdfppt.cxx:3183
sal_uInt32 nInstance
Definition: svdfppt.hxx:723
sal_uInt16 mnFont
Definition: svdfppt.hxx:754
sal_uInt32 mnFontColor
Definition: svdfppt.hxx:752
sal_uInt16 mnFlags
Definition: svdfppt.hxx:753
sal_uInt16 mnEscapement
Definition: svdfppt.hxx:757
sal_uInt16 mnFontHeight
Definition: svdfppt.hxx:756
sal_uInt16 mnAsianOrComplexFont
Definition: svdfppt.hxx:755
sal_uInt32 mnHylinkOrigColor
Definition: svdfppt.hxx:949
void SetColor(sal_uInt32 nColor)
Definition: svdfppt.cxx:4539
std::unique_ptr< SvxFieldItem > mpFieldItem
Definition: svdfppt.hxx:959
sal_uInt32 mnParagraph
Definition: svdfppt.hxx:956
friend class PPTPortionObj
Definition: svdfppt.hxx:974
PPTCharPropSet & operator=(const PPTCharPropSet &rCharPropSet)
Definition: svdfppt.cxx:4511
PPTCharPropSet(sal_uInt32 nParagraph)
Definition: svdfppt.cxx:4467
void SetFont(sal_uInt16 nFont)
Definition: svdfppt.cxx:4524
bool mbIsHyperlink
Definition: svdfppt.hxx:951
o3tl::cow_wrapper< ImplPPTCharPropSet > mpImplPPTCharPropSet
Definition: svdfppt.hxx:978
sal_uInt32 mnOriginalTextPos
Definition: svdfppt.hxx:955
LanguageType mnLanguage[3]
Definition: svdfppt.hxx:960
OUString maString
Definition: svdfppt.hxx:957
bool mbHardHylinkOrigColor
Definition: svdfppt.hxx:953
PPTCharLevel maCharLevel[nMaxPPTLevels]
Definition: svdfppt.hxx:762
void Read(SvStream &rIn, sal_uInt32 nLevel)
Definition: svdfppt.cxx:3835
PPTCharSheet(TSS_Type nInstance)
Definition: svdfppt.cxx:3795
sal_uInt16 mnHasAnm
Definition: svdfppt.hxx:705
sal_uInt32 mpfPP10Ext
Definition: svdfppt.hxx:707
sal_uInt16 mnBuBlip
Definition: svdfppt.hxx:704
sal_uInt32 mnAnmScheme
Definition: svdfppt.hxx:706
sal_uInt32 mnExtParagraphMask
Definition: svdfppt.hxx:703
sal_uInt32 mnExtCharacterMask
Definition: svdfppt.hxx:708
sal_uInt32 mcfPP10Ext
Definition: svdfppt.hxx:709
std::unique_ptr< SvxFieldItem > xField2
Definition: svdfppt.hxx:505
std::unique_ptr< SvxFieldItem > xField1
Definition: svdfppt.hxx:504
void SetDateTime(sal_uInt32 nType)
Definition: svdfppt.cxx:6425
static void GetDateTime(const sal_uInt32 nVal, SvxDateFormat &eDateFormat, SvxTimeFormat &eTimeFormat)
Definition: svdfppt.cxx:6382
sal_uInt16 mnDefaultTab
Definition: svdfppt.hxx:783
sal_uInt16 mnAdjust
Definition: svdfppt.hxx:777
sal_uInt16 mnLineFeed
Definition: svdfppt.hxx:778
sal_uInt16 mnTextOfs
Definition: svdfppt.hxx:781
sal_uInt16 mnBulletHeight
Definition: svdfppt.hxx:774
sal_uInt32 mnBulletColor
Definition: svdfppt.hxx:775
sal_uInt16 mnLowerDist
Definition: svdfppt.hxx:780
sal_uInt16 mnAsianLineBreak
Definition: svdfppt.hxx:784
sal_uInt16 mnBulletFont
Definition: svdfppt.hxx:773
sal_uInt16 mnBulletOfs
Definition: svdfppt.hxx:782
sal_uInt16 mnBulletChar
Definition: svdfppt.hxx:772
sal_uInt16 mnBiDi
Definition: svdfppt.hxx:787
sal_uInt16 mnBuFlags
Definition: svdfppt.hxx:771
sal_uInt16 mnUpperDist
Definition: svdfppt.hxx:779
PPTParaPropSet & operator=(const PPTParaPropSet &rParaPropSet)
Definition: svdfppt.cxx:4457
rtl::Reference< ImplPPTParaPropSet > mxParaSet
Definition: svdfppt.hxx:910
sal_uInt32 mnOriginalTextPos
Definition: svdfppt.hxx:909
void Read(SdrPowerPointImport const &rMan, SvStream &rIn, sal_uInt32 nLevel, bool bFirst)
Definition: svdfppt.cxx:3927
PPTParaSheet(TSS_Type nInstance)
Definition: svdfppt.cxx:3882
PPTParaLevel maParaLevel[nMaxPPTLevels]
Definition: svdfppt.hxx:794
void UpdateBulletRelSize(sal_uInt32 nLevel, sal_uInt16 nFontHeight)
Definition: svdfppt.cxx:4083
virtual ~PPTRuler() override
Definition: svdfppt.cxx:4552
PPTStyleSheet(const DffRecordHeader &rSlideHd, SvStream &rSt, SdrPowerPointImport &, const PPTTextParagraphStyleAtomInterpreter &, const PPTTextSpecInfo &)
Definition: svdfppt.cxx:4095
PPTTextSpecInfo maTxSI
Definition: svdfppt.hxx:863
o3tl::enumarray< TSS_Type, std::unique_ptr< PPTParaSheet > > mpParaSheet
Definition: svdfppt.hxx:865
o3tl::enumarray< TSS_Type, std::unique_ptr< PPTCharSheet > > mpCharSheet
Definition: svdfppt.hxx:864
o3tl::enumarray< TSS_Type, std::unique_ptr< SvxNumBulletItem > > mpNumBulletItem
Definition: svdfppt.hxx:866
std::vector< std::unique_ptr< PPTCharPropSet > > aCharPropList
Definition: svdfppt.hxx:1065
std::vector< std::unique_ptr< PPTParaPropSet > > aParaPropList
Definition: svdfppt.hxx:1064
void ReadParaProps(SvStream &rIn, const DffRecordHeader &rTextHeader, const OUString &aString, PPTTextRulerInterpreter const &rRuler, sal_uInt32 &nCharCount, bool &bTextPropAtom)
Definition: svdfppt.cxx:4862
PPTStyleTextPropReader(SvStream &rIn, const DffRecordHeader &rClientTextBoxHd, PPTTextRulerInterpreter const &rInterpreter, const DffRecordHeader &rExtParaHd, TSS_Type nTextInstance)
Definition: svdfppt.cxx:4856
std::vector< sal_uInt32 > aSpecMarkerList
Definition: svdfppt.hxx:1063
void Init(SvStream &rIn, const DffRecordHeader &rClientTextBoxHd, PPTTextRulerInterpreter const &rInterpreter, const DffRecordHeader &rExtParaHd, TSS_Type nTextInstance)
Definition: svdfppt.cxx:5206
static void ReadCharProps(SvStream &rIn, PPTCharPropSet &aCharPropSet, std::u16string_view aString, sal_uInt32 &nCharCount, sal_uInt32 nCharReadCnt, bool &bTextPropAtom, sal_uInt32 nExtParaPos, const std::vector< StyleTextProp9 > &aStyleTextProp9, sal_uInt32 &nExtParaFlags, sal_uInt16 &nBuBlip, sal_uInt16 &nHasAnm, sal_uInt32 &nAnmScheme)
Definition: svdfppt.cxx:5118
bool Read(SvStream &rIn, const DffRecordHeader &rRecHd)
Definition: svdfppt.cxx:4691
bool GetDefaultTab(sal_uInt16 &nValue) const
Definition: svdfppt.cxx:4646
PPTTextRulerInterpreter & operator=(const PPTTextRulerInterpreter &rRuler)
Definition: svdfppt.cxx:4670
sal_uInt16 GetTabOffsetByIndex(sal_uInt16 nIndex) const
Definition: svdfppt.hxx:1015
bool GetBulletOfs(sal_uInt32 nLevel, sal_uInt16 &nValue) const
Definition: svdfppt.cxx:4662
sal_uInt16 GetTabCount() const
Definition: svdfppt.hxx:1021
sal_uInt16 GetTabStyleByIndex(sal_uInt16 nIndex) const
Definition: svdfppt.hxx:1018
bool GetTextOfs(sal_uInt32 nLevel, sal_uInt16 &nValue) const
Definition: svdfppt.cxx:4654
rtl::Reference< PPTRuler > mxImplRuler
Definition: svdfppt.hxx:1004
::std::vector< PPTTextSpecInfo > aList
Definition: svdfppt.hxx:685
bool Read(SvStream &rIn, const DffRecordHeader &rRecHd, sal_uInt16 nRecordType, const PPTTextSpecInfo *pTextSpecDefault=nullptr)
Definition: svdfppt.cxx:4768
LanguageType nLanguage[3]
Definition: svdfppt.hxx:676
PPTTextSpecInfo(sal_uInt32 nCharIdx)
Definition: svdfppt.cxx:4754
sal_uInt32 nCharIdx
Definition: svdfppt.hxx:675
sal_uInt16 nDontKnow
Definition: svdfppt.hxx:677
PowerPointImportParam(SvStream &rDocStream)
Definition: svdfppt.cxx:160
sal_uInt32 nImportFlags
Definition: svdfppt.hxx:96
PptCurrentUserAtom aCurrentUserAtom
Definition: svdfppt.hxx:97
Color GetColor(sal_uInt16 nNum) const
Definition: svdfppt.cxx:354
sal_uInt8 aData[32]
Definition: svdfppt.hxx:270
OUString aCurrentUser
Definition: svdfppt.hxx:80
sal_uInt8 nMajorVersion
Definition: svdfppt.hxx:78
sal_uInt16 nDocFileVersion
Definition: svdfppt.hxx:77
sal_uInt8 nMinorVersion
Definition: svdfppt.hxx:79
sal_uInt32 nMagic
Definition: svdfppt.hxx:75
sal_uInt32 nCurrentUserEdit
Definition: svdfppt.hxx:76
Size aNotesPageSize
Definition: svdfppt.hxx:183
sal_uInt32 nNotesMasterPersist
Definition: svdfppt.hxx:185
Size const & GetSlidesPageSize() const
Definition: svdfppt.hxx:208
Size aSlidesPageSize
Definition: svdfppt.hxx:182
PptPageFormat eSlidesPageFormat
Definition: svdfppt.hxx:188
sal_uInt32 nHandoutMasterPersist
Definition: svdfppt.hxx:186
Size const & GetNotesPageSize() const
Definition: svdfppt.hxx:209
bool bTitlePlaceholdersOmitted
Definition: svdfppt.hxx:190
bool bShowComments
Definition: svdfppt.hxx:192
bool bEmbeddedTrueType
Definition: svdfppt.hxx:189
sal_uInt16 n1stPageNumber
Definition: svdfppt.hxx:187
sal_uInt32 nId
Definition: svdfppt.hxx:444
sal_uInt32 nAspect
Definition: svdfppt.hxx:443
sal_uInt32 nPersistPtr
Definition: svdfppt.hxx:445
sal_uInt8 lfClipPrecision
Definition: svdfppt.hxx:282
rtl_TextEncoding eCharSet
Definition: svdfppt.hxx:285
FontPitch ePitch
Definition: svdfppt.hxx:287
OUString aName
Definition: svdfppt.hxx:281
FontFamily eFamily
Definition: svdfppt.hxx:286
sal_uInt8 lfQuality
Definition: svdfppt.hxx:283
sal_uInt32 nSoundRef
Definition: svdfppt.hxx:118
sal_uInt32 nExHyperlinkId
Definition: svdfppt.hxx:119
sal_uInt8 nHyperlinkType
Definition: svdfppt.hxx:124
sal_uInt16 nFlags
Definition: svdfppt.hxx:259
sal_uInt32 nSlideId
Definition: svdfppt.hxx:258
void Clear()
Definition: svdfppt.cxx:344
sal_uInt32 nPlacementId
Definition: svdfppt.hxx:343
sal_uInt8 nPlaceholderSize
Definition: svdfppt.hxx:345
PptPlaceholder nPlaceholderId
Definition: svdfppt.hxx:344
sal_uInt32 nMasterId
Definition: svdfppt.hxx:230
sal_uInt32 nNotesId
Definition: svdfppt.hxx:231
void Clear()
Definition: svdfppt.cxx:327
sal_uInt16 nFlags
Definition: svdfppt.hxx:232
PptSlideLayoutAtom aLayout
Definition: svdfppt.hxx:229
PptSlideLayout eLayout
Definition: svdfppt.hxx:216
PptPlaceholder aPlaceholderId[8]
Definition: svdfppt.hxx:217
sal_uInt32 nSlideId
Definition: svdfppt.hxx:246
sal_uInt32 nFlags
Definition: svdfppt.hxx:244
sal_uInt32 nReserved
Definition: svdfppt.hxx:247
sal_uInt32 nPsrReference
Definition: svdfppt.hxx:243
sal_uInt32 nNumberTexts
Definition: svdfppt.hxx:245
PptSlidePersistAtom aPersistAtom
Definition: svdfppt.hxx:361
std::unique_ptr< PPTStyleSheet > xStyleSheet
Definition: svdfppt.hxx:365
sal_uInt32 HeaderFooterOfs[4]
Definition: svdfppt.hxx:367
std::unique_ptr< SvxMSDffSolverContainer > xSolverContainer
Definition: svdfppt.hxx:369
PptPageKind ePageKind
Definition: svdfppt.hxx:379
PptSlideAtom aSlideAtom
Definition: svdfppt.hxx:362
sal_uInt32 nSlidePersistEndOffset
Definition: svdfppt.hxx:371
PptColorSchemeAtom aColorScheme
Definition: svdfppt.hxx:364
rtl::Reference< SdrObject > pBObj
Definition: svdfppt.hxx:377
sal_uInt32 nDrawingDgId
Definition: svdfppt.hxx:373
std::unique_ptr< HeaderFooterEntry > xHeaderFooterEntry
Definition: svdfppt.hxx:368
PptNotesAtom aNotesAtom
Definition: svdfppt.hxx:363
std::unique_ptr< sal_uInt32[]> pPresentationObjects
Definition: svdfppt.hxx:375
sal_uInt32 nOffsetLastEdit
Definition: svdfppt.hxx:321
DffRecordHeader aHd
Definition: svdfppt.hxx:318
sal_Int32 nLastSlideID
Definition: svdfppt.hxx:319
sal_uInt32 nMaxPersistWritten
Definition: svdfppt.hxx:324
sal_uInt32 nVersion
Definition: svdfppt.hxx:320
PptViewTypeEnum eLastViewType
Definition: svdfppt.hxx:325
sal_uInt32 nDocumentRef
Definition: svdfppt.hxx:323
sal_uInt32 nOffsetPersistDirectory
Definition: svdfppt.hxx:322
std::unique_ptr< sal_uInt32[]> pTableRowProperties
Definition: svdfppt.hxx:546
PptSlidePersistEntry & rPersistEntry
Definition: svdfppt.hxx:543
::std::vector< rtl::Reference< SdrObject > > aBackgroundColoredObjects
Definition: svdfppt.hxx:545
virtual void NotifyFreeObj(SdrObject *pObj) override
Definition: svdfppt.cxx:709
SdPageCapsule pPage
Definition: svdfppt.hxx:544
OUString aTarget
Definition: svdfppt.hxx:109
OUString aConvSubString
Definition: svdfppt.hxx:112
sal_uInt32 nIndex
Definition: svdfppt.hxx:104
SdrPage * page
Definition: svdfppt.hxx:457
sal_uInt32 mnSpecialInfoMask
Definition: svdfppt.hxx:1041
sal_uInt32 mnExtParagraphMask
Definition: svdfppt.hxx:1034
sal_uInt16 mnBuBlip
Definition: svdfppt.hxx:1035
sal_uInt32 mncfPP10Ext
Definition: svdfppt.hxx:1040
sal_uInt16 mfBidi
Definition: svdfppt.hxx:1043
void Read(SvStream &rSt)
Definition: svdfppt.cxx:4835
sal_uInt32 mnExtCharacterMask
Definition: svdfppt.hxx:1039
sal_uInt16 mnHasAnm
Definition: svdfppt.hxx:1036
sal_uInt32 mpfPP10Ext
Definition: svdfppt.hxx:1038
sal_uInt32 mnAnmScheme
Definition: svdfppt.hxx:1037
sal_uInt32 mnPP10Ext
Definition: svdfppt.hxx:1042
::std::vector< std::unique_ptr< SvxMSDffConnectorRule > > aCList
Definition: msdffimp.hxx:188
Reference< XModel > xModel
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LEFTDIST(SDRATTR_MISC_FIRST+4)
constexpr TypedWhichId< SdrTextFixedCellHeightItem > SDRATTR_TEXT_USEFIXEDCELLHEIGHT(SDRATTR_MISC_FIRST+23)
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_RIGHTDIST(SDRATTR_MISC_FIRST+5)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LOWERDIST(SDRATTR_MISC_FIRST+7)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_UPPERDIST(SDRATTR_MISC_FIRST+6)
#define FIXED_PITCH
Definition: svdfppt.cxx:150
SvStream & ReadPptSlideLayoutAtom(SvStream &rIn, PptSlideLayoutAtom &rAtom)
Definition: svdfppt.cxx:305
#define DEFAULT_PITCH
Definition: svdfppt.cxx:149
#define VARIABLE_PITCH
Definition: svdfppt.cxx:151
static bool SdrPowerPointOLEDecompress(SvStream &rOutput, SvStream &rInput, sal_uInt32 nInputSize)
Definition: svdfppt.cxx:1783
#define FF_MODERN
Definition: svdfppt.cxx:145
SvStream & ReadPptExOleObjAtom(SvStream &rIn, PptExOleObjAtom &rAtom)
Definition: svdfppt.cxx:234
#define FF_DECORATIVE
Definition: svdfppt.cxx:147
SvStream & ReadPptNotesAtom(SvStream &rIn, PptNotesAtom &rAtom)
Definition: svdfppt.cxx:333
#define LinePositionTop
Definition: svdfppt.cxx:7160
#define FF_SCRIPT
Definition: svdfppt.cxx:146
#define FF_ROMAN
Definition: svdfppt.cxx:143
#define PPT_COLSCHEME_TITELTEXT
Definition: svdfppt.cxx:136
static void MergeCells(const Reference< XTable > &xTable, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan)
Definition: svdfppt.cxx:7328
SvStream & ReadPptUserEditAtom(SvStream &rIn, PptUserEditAtom &rAtom)
Definition: svdfppt.cxx:458
#define LinePositionRight
Definition: svdfppt.cxx:7161
static bool IsLine(const SdrObject *pObj)
Definition: svdfppt.cxx:7118
static void CreateTableColumns(const Reference< XTableColumns > &xTableColumns, const o3tl::sorted_vector< sal_Int32 > &rColumns, sal_Int32 nTableRight)
Definition: svdfppt.cxx:7301
#define LinePositionTLBR
Definition: svdfppt.cxx:7163
#define PPT_COLSCHEME_A_UND_HYPERLINK
Definition: svdfppt.cxx:137
SvStream & ReadPptOEPlaceholderAtom(SvStream &rIn, PptOEPlaceholderAtom &rAtom)
Definition: svdfppt.cxx:482
#define LinePositionBottom
Definition: svdfppt.cxx:7162
static void ApplyCellLineAttributes(const SdrObject *pLine, Reference< XTable > const &xTable, const std::vector< sal_Int32 > &vPositions, sal_Int32 nColumns)
Definition: svdfppt.cxx:7449
static bool GetCellPosition(const SdrObject *pObj, const o3tl::sorted_vector< sal_Int32 > &rRows, const o3tl::sorted_vector< sal_Int32 > &rColumns, sal_Int32 &nTableIndex, sal_Int32 &nRow, sal_Int32 &nRowCount, sal_Int32 &nColumn, sal_Int32 &nColumnCount)
Definition: svdfppt.cxx:7124
SvStream & ReadPptSlideAtom(SvStream &rIn, PptSlideAtom &rAtom)
Definition: svdfppt.cxx:315
SvStream & ReadPptCurrentUserAtom(SvStream &rIn, PptCurrentUserAtom &rAtom)
Definition: svdfppt.cxx:166
bool ReadPptInteractiveInfoAtom(SvStream &rIn, PptInteractiveInfoAtom &rAtom)
Definition: svdfppt.cxx:219
static void GetColumnPositions(const tools::Rectangle &rSnapRect, const o3tl::sorted_vector< sal_Int32 > &rColumns, std::vector< sal_Int32 > &rPositions, sal_Int32 nRow, sal_Int32 nFlags)
Definition: svdfppt.cxx:7188
#define PPT_COLSCHEME_TEXT_UND_ZEILEN
Definition: svdfppt.cxx:135
#define LinePositionLeft
Definition: svdfppt.cxx:7159
#define ANSI_CHARSET
Definition: svdfppt.cxx:139
static void GetRowPositions(const tools::Rectangle &rSnapRect, const o3tl::sorted_vector< sal_Int32 > &rRows, const o3tl::sorted_vector< sal_Int32 > &rColumns, std::vector< sal_Int32 > &rPositions, sal_Int32 nColumn, sal_Int32 nFlags)
Definition: svdfppt.cxx:7167
#define PPT_COLSCHEME_HINTERGRUND
Definition: svdfppt.cxx:134
SvStream & ReadPptFontEntityAtom(SvStream &rIn, PptFontEntityAtom &rAtom)
Definition: svdfppt.cxx:376
SvStream & ReadPptColorSchemeAtom(SvStream &rIn, PptColorSchemeAtom &rAtom)
Definition: svdfppt.cxx:367
#define LinePositionBLTR
Definition: svdfppt.cxx:7164
static void CreateTableRows(const Reference< XTableRows > &xTableRows, const o3tl::sorted_vector< sal_Int32 > &rRows, sal_Int32 nTableBottom)
Definition: svdfppt.cxx:7274
SvStream & ReadPPTExtParaLevel(SvStream &rIn, PPTExtParaLevel &rLevel)
Definition: svdfppt.cxx:3198
static void ApplyCellAttributes(const SdrObject *pObj, Reference< XCell > const &xCell)
Definition: svdfppt.cxx:7347
static void GetLinePositions(const SdrObject *pObj, const o3tl::sorted_vector< sal_Int32 > &rRows, const o3tl::sorted_vector< sal_Int32 > &rColumns, std::vector< sal_Int32 > &rPositions, const tools::Rectangle &rGroupSnap)
Definition: svdfppt.cxx:7208
#define PPT_COLSCHEME
Definition: svdfppt.cxx:133
#define FF_SWISS
Definition: svdfppt.cxx:144
#define SYMBOL_CHARSET
Definition: svdfppt.cxx:140
SvStream & ReadPptDocumentAtom(SvStream &rIn, PptDocumentAtom &rAtom)
Definition: svdfppt.cxx:249
static void ImportComment10(SvxMSDffManager const &rMan, SvStream &rStCtrl, SdrPage *pPage, DffRecordHeader const &rComment10Hd)
Definition: svdfppt.cxx:2680
SvStream & ReadPptSlidePersistAtom(SvStream &rIn, PptSlidePersistAtom &rAtom)
Definition: svdfppt.cxx:193
#define PPT_ParaAttr_BuHardFont
Definition: svdfppt.hxx:1399
#define PPT_CharAttr_FontColor
Definition: svdfppt.hxx:1429
#define PPT_PST_TxPFStyleAtom
Definition: svdfppt.hxx:1334
#define PPT_PST_Document
Definition: svdfppt.hxx:1299
#define PPT_PST_VBAInfo
Definition: svdfppt.hxx:1306
#define PPT_CharAttr_Strikeout
Definition: svdfppt.hxx:1422
#define PPT_PST_UserEditAtom
Definition: svdfppt.hxx:1366
PptPageKind
Definition: svdfppt.hxx:136
@ PPT_MASTERPAGE
Definition: svdfppt.hxx:136
@ PPT_NOTEPAGE
Definition: svdfppt.hxx:136
@ PPT_SLIDEPAGE
Definition: svdfppt.hxx:136
#define PPT_PST_TextDefaults9Atom
Definition: svdfppt.hxx:1346
#define PPT_PST_OEPlaceholderAtom
Definition: svdfppt.hxx:1328
#define PPT_PST_ExtendedBuGraContainer
Definition: svdfppt.hxx:1324
#define PPT_ParaAttr_DefaultTab
Definition: svdfppt.hxx:1412
#define PPT_CharAttr_Symbol
Definition: svdfppt.hxx:1427
#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT
Definition: svdfppt.hxx:1197
#define PPT_PST_CommentAtom10
Definition: svdfppt.hxx:1391
#define PPT_PST_SlideNumberMCAtom
Definition: svdfppt.hxx:1355
#define PPT_PST_TxSIStyleAtom
Definition: svdfppt.hxx:1337
#define PPT_ParaAttr_UpperDist
Definition: svdfppt.hxx:1408
#define PPT_PST_NotesAtom
Definition: svdfppt.hxx:1302
#define PPT_PST_PresentationAdvisorFlags9Atom
Definition: svdfppt.hxx:1384
#define PPT_PST_TextHeaderAtom
Definition: svdfppt.hxx:1330
#define PPT_PST_DocToolbarStates10Atom
Definition: svdfppt.hxx:1395
#define PPT_PST_SrKinsoku
Definition: svdfppt.hxx:1351
#define PPT_PST_StyleTextPropAtom
Definition: svdfppt.hxx:1332
#define PPT_ParaAttr_BuHardColor
Definition: svdfppt.hxx:1400
#define PPT_PST_RecolorInfoAtom
Definition: svdfppt.hxx:1360
#define PPT_PST_ExEmbed
Definition: svdfppt.hxx:1352
PptPageFormat
Definition: svdfppt.hxx:139
#define PPT_ParaAttr_Adjust
Definition: svdfppt.hxx:1406
#define PPT_SPEC_NEWLINE
Definition: svdfppt.hxx:1029
#define PPT_ParaAttr_BiDi
Definition: svdfppt.hxx:1416
#define PPT_CharAttr_Shadow
Definition: svdfppt.hxx:1421
#define PPT_ParaAttr_BulletOfs
Definition: svdfppt.hxx:1411
#define PPT_PST_ExtendedParagraphHeaderAtom
Definition: svdfppt.hxx:1344
#define PPT_PST_SlidePersistAtom
Definition: svdfppt.hxx:1304
const int nMaxPPTLevels
Definition: svdfppt.hxx:175
#define PPT_PST_ExOleObjAtom
Definition: svdfppt.hxx:1350
#define PPT_ParaAttr_AsianLB_1
Definition: svdfppt.hxx:1413
#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT
Definition: svdfppt.hxx:1195
#define PPT_ParaAttr_BulletChar
Definition: svdfppt.hxx:1405
#define PPT_PST_FooterMCAtom
Definition: svdfppt.hxx:1371
#define PPT_ParaAttr_LowerDist
Definition: svdfppt.hxx:1409
#define PPT_PST_GridSpacing10Atom
Definition: svdfppt.hxx:1312
#define PPT_SPEC_SYMBOL
Definition: svdfppt.hxx:1030
#define PPT_PST_HeadersFootersAtom
Definition: svdfppt.hxx:1357
#define PPT_PST_HeaderMCAtom
Definition: svdfppt.hxx:1370
#define PPT_PST_InteractiveInfo
Definition: svdfppt.hxx:1364
#define PPT_PST_TextRulerAtom
Definition: svdfppt.hxx:1335
TSS_Type
Definition: svdfppt.hxx:161
#define PPT_CharAttr_Embossed
Definition: svdfppt.hxx:1423
#define PPT_PST_HtmlDocInfo9Atom
Definition: svdfppt.hxx:1385
#define PPT_PST_MasterText
Definition: svdfppt.hxx:1359
#define PPT_PST_PersistPtrIncrementalBlock
Definition: svdfppt.hxx:1381
#define PPT_PST_ExControl
Definition: svdfppt.hxx:1361
#define PPT_PST_SlideAtom
Definition: svdfppt.hxx:1301
#define PPT_PST_InteractiveInfoAtom
Definition: svdfppt.hxx:1365
#define PPT_PST_TxInteractiveInfoAtom
Definition: svdfppt.hxx:1358
#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER
Definition: svdfppt.hxx:1196
#define PPT_PST_CString
Definition: svdfppt.hxx:1349
#define PPT_PST_ExObjList
Definition: svdfppt.hxx:1309
#define PPT_ParaAttr_BulletFont
Definition: svdfppt.hxx:1402
#define PPT_PST_SlideTime10Atom
Definition: svdfppt.hxx:1394
#define PPT_PST_PPDrawing
Definition: svdfppt.hxx:1311
#define PPT_PST_SlideListWithText
Definition: svdfppt.hxx:1362
#define PPT_PST_TextSpecInfoAtom
Definition: svdfppt.hxx:1338
#define PPT_PST_CurrentUserAtom
Definition: svdfppt.hxx:1367
#define PPT_PST_ExtendedBuGraAtom
Definition: svdfppt.hxx:1325
#define PPT_PST_HashCodeAtom
Definition: svdfppt.hxx:1388
#define PPT_PST_SlideFlags10Atom
Definition: svdfppt.hxx:1393
#define PPT_CharAttr_Font
Definition: svdfppt.hxx:1424
PptSlideLayout
Definition: svdfppt.hxx:1434
#define PPT_PST_DocumentAtom
Definition: svdfppt.hxx:1300
#define PPT_CharAttr_Italic
Definition: svdfppt.hxx:1419
#define PPT_PST_ExtendedPresRuleContainer
Definition: svdfppt.hxx:1343
#define PPT_ParaAttr_AsianLB_3
Definition: svdfppt.hxx:1415
#define PPT_PST_ColorSchemeAtom
Definition: svdfppt.hxx:1321
#define PPT_PST_BuildList
Definition: svdfppt.hxx:1389
#define PPT_PST_CommentIndex10
Definition: svdfppt.hxx:1392
#define PPT_CharAttr_FontHeight
Definition: svdfppt.hxx:1428
#define PPT_ParaAttr_BulletColor
Definition: svdfppt.hxx:1403
#define PPT_PST_BinaryTagData
Definition: svdfppt.hxx:1380
#define PPT_PST_HeadersFooters
Definition: svdfppt.hxx:1356
#define PPT_PST_DateTimeMCAtom
Definition: svdfppt.hxx:1368
#define PPT_PST_GenericDateMCAtom
Definition: svdfppt.hxx:1369
#define PPT_PST_TextBytesAtom
Definition: svdfppt.hxx:1336
PptPlaceholder
Definition: svdfppt.hxx:1458
#define PPT_PST_TxMasterStyleAtom
Definition: svdfppt.hxx:1333
#define PPT_ParaAttr_BuHardHeight
Definition: svdfppt.hxx:1401
#define PPT_ParaAttr_BulletHeight
Definition: svdfppt.hxx:1404
#define PPT_ParaAttr_LineFeed
Definition: svdfppt.hxx:1407
#define PPT_ParaAttr_BulletOn
Definition: svdfppt.hxx:1398
#define PPT_CharAttr_Escapement
Definition: svdfppt.hxx:1430
#define PPT_PST_FontCollection
Definition: svdfppt.hxx:1317
#define PPT_PST_ProgBinaryTag
Definition: svdfppt.hxx:1379
#define PPT_PST_ExtendedParagraphMasterAtom
Definition: svdfppt.hxx:1342
#define PPT_PST_RTFDateTimeMCAtom
Definition: svdfppt.hxx:1377
#define PPTSLIDEPERSIST_ENTRY_NOTFOUND
Definition: svdfppt.hxx:390
#define PPT_CharAttr_AsianOrComplexFont
Definition: svdfppt.hxx:1425
#define PPT_CharAttr_Bold
Definition: svdfppt.hxx:1418
#define PPT_PST_Comment10
Definition: svdfppt.hxx:1390
#define PPT_PST_List
Definition: svdfppt.hxx:1316
#define PPT_PST_TextCharsAtom
Definition: svdfppt.hxx:1331
#define PPT_IMPORTFLAGS_NO_TEXT_ASSERT
Definition: svdfppt.hxx:71
#define PPT_PST_VBAInfoAtom
Definition: svdfppt.hxx:1307
#define PPT_PST_ProgTags
Definition: svdfppt.hxx:1378
#define PPT_STYLESHEETENTRIES
Definition: svdfppt.hxx:699
#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK
Definition: svdfppt.hxx:1198
#define PPT_PST_OutlineTextRefAtom
Definition: svdfppt.hxx:1329
#define PPT_ParaAttr_TextOfs
Definition: svdfppt.hxx:1410
#define PPT_PST_ExtendedParagraphAtom
Definition: svdfppt.hxx:1341
#define PPT_PST_Environment
Definition: svdfppt.hxx:1303
#define PPT_CharAttr_Underline
Definition: svdfppt.hxx:1420
#define PPT_PST_FontEntityAtom
Definition: svdfppt.hxx:1348
PptViewTypeEnum
Definition: svdfppt.hxx:294
#define PPT_CharAttr_ANSITypeface
Definition: svdfppt.hxx:1426
#define PPT_ParaAttr_AsianLB_2
Definition: svdfppt.hxx:1414
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
SdrObjKind
SVXCORE_DLLPUBLIC FrPair GetMapFactor(MapUnit eS, MapUnit eD)
bool IsInch(MapUnit eU)
SVXCORE_DLLPUBLIC tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv)
SVX_NUM_NUMBER_NONE
SVX_NUM_FULL_WIDTH_ARABIC
SVX_NUM_CHARS_LOWER_LETTER_N
SVX_NUM_CIRCLE_NUMBER
SVX_NUM_CHARS_LOWER_LETTER
SVX_NUM_CHARS_UPPER_LETTER
SVX_NUM_NUMBER_UPPER_ZH_TW
SVX_NUM_ROMAN_UPPER
SVX_NUM_ROMAN_LOWER
SVX_NUM_ARABIC
SVX_NUM_CHARS_UPPER_LETTER_N
SVX_NUM_NUMBER_UPPER_ZH
SVX_NUM_BITMAP
SVX_NUM_CHAR_SPECIAL
SVX_NUM_NUMBER_LOWER_ZH
SVX_NUM_NUMBER_HEBREW
SvxTabAdjust
SvxAdjust
unsigned char sal_uInt8
#define SAL_MAX_INT32
sal_uInt16 sal_Unicode
signed char sal_Int8
#define SAL_MAX_UINT32
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XFillBmpStretchItem > XATTR_FILLBMP_STRETCH(XATTR_FILL_FIRST+16)
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)