LCOV - code coverage report
Current view: top level - filter/source/msfilter - svdfppt.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3108 4277 72.7 %
Date: 2015-06-13 12:38:46 Functions: 160 185 86.5 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11