LCOV - code coverage report
Current view: top level - filter/source/msfilter - svdfppt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2518 4172 60.4 %
Date: 2012-08-25 Functions: 139 180 77.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2304 7001 32.9 %

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

Generated by: LCOV version 1.10