LCOV - code coverage report
Current view: top level - sd/source/filter/eppt - epptso.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2349 0.0 %
Date: 2014-04-14 Functions: 0 41 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sal/config.h>
      21             : 
      22             : #include <cstdlib>
      23             : 
      24             : #include <osl/endian.h>
      25             : #include <eppt.hxx>
      26             : #include "text.hxx"
      27             : #include "epptdef.hxx"
      28             : #include "escherex.hxx"
      29             : #include <tools/poly.hxx>
      30             : #include <vcl/bmpacc.hxx>
      31             : #include <vcl/gradient.hxx>
      32             : #include <vcl/gfxlink.hxx>
      33             : #include <tools/stream.hxx>
      34             : #include <sot/storage.hxx>
      35             : #include <vcl/outdev.hxx>
      36             : #include <vcl/virdev.hxx>
      37             : #include <sfx2/app.hxx>
      38             : #include <svl/languageoptions.hxx>
      39             : #include <editeng/svxenum.hxx>
      40             : #include <svx/unoapi.hxx>
      41             : #include <svx/svdoashp.hxx>
      42             : #include <com/sun/star/style/VerticalAlignment.hpp>
      43             : #include <com/sun/star/container/XIndexReplace.hpp>
      44             : #include <com/sun/star/presentation/XPresentationPage.hpp>
      45             : #include <com/sun/star/awt/XFont.hpp>
      46             : #include <com/sun/star/awt/FontWeight.hpp>
      47             : #include <com/sun/star/awt/FontUnderline.hpp>
      48             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      49             : #include <com/sun/star/style/LineSpacing.hpp>
      50             : #include <com/sun/star/style/LineSpacingMode.hpp>
      51             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      52             : #include <com/sun/star/style/XStyle.hpp>
      53             : #include <com/sun/star/drawing/PointSequence.hpp>
      54             : #include <com/sun/star/drawing/FlagSequence.hpp>
      55             : #include <com/sun/star/drawing/PolygonFlags.hpp>
      56             : #include <com/sun/star/beans/PropertyValue.hpp>
      57             : #include <com/sun/star/drawing/XControlShape.hpp>
      58             : #include <comphelper/processfactory.hxx>
      59             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      60             : #include <com/sun/star/i18n/XBreakIterator.hpp>
      61             : #include <com/sun/star/i18n/XScriptTypeDetector.hpp>
      62             : #include <com/sun/star/i18n/ScriptType.hpp>
      63             : #include <com/sun/star/i18n/ScriptDirection.hpp>
      64             : #include <com/sun/star/embed/Aspects.hpp>
      65             : #include <vcl/cvtgrf.hxx>
      66             : #include <tools/urlobj.hxx>
      67             : #include <comphelper/extract.hxx>
      68             : #include <cppuhelper/proptypehlp.hxx>
      69             : #include <toolkit/helper/vclunohelper.hxx>
      70             : #include <rtl/crc.h>
      71             : #include <comphelper/classids.hxx>
      72             : #include <unotools/ucbstreamhelper.hxx>
      73             : #include <com/sun/star/text/FontRelief.hpp>
      74             : #include <editeng/frmdiritem.hxx>
      75             : #include <vcl/fltcall.hxx>
      76             : #include <com/sun/star/table/XTable.hpp>
      77             : #include <com/sun/star/table/XMergeableCell.hpp>
      78             : #include <com/sun/star/table/BorderLine.hpp>
      79             : #include <set>
      80             : #include <oox/ole/olehelper.hxx>
      81             : #include "i18nlangtag/languagetag.hxx"
      82             : 
      83             : using namespace ::com::sun::star;
      84             : 
      85             : #define ANSI_CHARSET            0
      86             : #define SYMBOL_CHARSET          2
      87             : 
      88             : /* Font Families */
      89             : #define FF_ROMAN                0x10
      90             : #define FF_SWISS                0x20
      91             : #define FF_MODERN               0x30
      92             : #define FF_SCRIPT               0x40
      93             : #define FF_DECORATIVE           0x50
      94             : 
      95             : #define DEFAULT_PITCH           0x00
      96             : #define FIXED_PITCH             0x01
      97             : 
      98           0 : PPTExBulletProvider::PPTExBulletProvider()
      99             : {
     100           0 :     pGraphicProv = new EscherGraphicProvider( _E_GRAPH_PROV_USE_INSTANCES  | _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
     101           0 : }
     102             : 
     103           0 : PPTExBulletProvider::~PPTExBulletProvider()
     104             : {
     105           0 :     delete pGraphicProv;
     106           0 : }
     107             : 
     108           0 : sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicSize )
     109             : {
     110           0 :     sal_uInt16 nRetValue = 0xffff;
     111             : 
     112           0 :     if ( !rUniqueId.isEmpty() )
     113             :     {
     114           0 :         Rectangle       aRect;
     115           0 :         GraphicObject   aGraphicObject( rUniqueId );
     116           0 :         Graphic         aMappedGraphic, aGraphic( aGraphicObject.GetGraphic() );
     117           0 :         Size            aPrefSize( aGraphic.GetPrefSize() );
     118           0 :         BitmapEx        aBmpEx( aGraphic.GetBitmapEx() );
     119             : 
     120           0 :         if ( rGraphicSize.Width() && rGraphicSize.Height() )
     121             :         {
     122           0 :             double          fQ1 = ( (double)aPrefSize.Width() / (double)aPrefSize.Height() );
     123           0 :             double          fQ2 = ( (double)rGraphicSize.Width() / (double)rGraphicSize.Height() );
     124           0 :             double          fXScale = 1;
     125           0 :             double          fYScale = 1;
     126             : 
     127           0 :             if ( fQ1 > fQ2 )
     128           0 :                 fYScale = fQ1 / fQ2;
     129           0 :             else if ( fQ1 < fQ2 )
     130           0 :                 fXScale = fQ2 / fQ1;
     131             : 
     132           0 :             if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
     133             :             {
     134           0 :                 aBmpEx.Scale( fXScale, fYScale );
     135           0 :                 Size aNewSize( (sal_Int32)((double)rGraphicSize.Width() / fXScale + 0.5 ),
     136           0 :                                 (sal_Int32)((double)rGraphicSize.Height() / fYScale + 0.5 ) );
     137             : 
     138           0 :                 rGraphicSize = aNewSize;
     139             : 
     140           0 :                 aMappedGraphic = Graphic( aBmpEx );
     141           0 :                 aGraphicObject = GraphicObject( aMappedGraphic );
     142             :             }
     143             :         }
     144           0 :         sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRect, NULL, NULL );
     145             : 
     146           0 :         if ( nId && ( nId < 0x10000 ) )
     147           0 :             nRetValue = (sal_uInt16)nId - 1;
     148             :     }
     149           0 :     return nRetValue;
     150             : }
     151             : 
     152           0 : sal_uInt32 PPTWriter::ImplVBAInfoContainer( SvStream* pStrm )
     153             : {
     154           0 :     sal_uInt32 nSize = 28;
     155           0 :     if ( pStrm )
     156             :     {
     157           0 :         pStrm->WriteUInt32( (sal_uInt32)( 0x1f | ( EPP_VBAInfo << 16 ) ) )
     158           0 :               .WriteUInt32( (sal_uInt32)( nSize - 8 ) )
     159           0 :               .WriteUInt32( (sal_uInt32)( 2 | ( EPP_VBAInfoAtom << 16 ) ) )
     160           0 :               .WriteUInt32( (sal_uInt32)12 );
     161           0 :         mpPptEscherEx->InsertPersistOffset( EPP_Persist_VBAInfoAtom, pStrm->Tell() );
     162           0 :         pStrm->WriteUInt32( (sal_uInt32)0 )
     163           0 :               .WriteUInt32( (sal_uInt32)0 )
     164           0 :               .WriteUInt32( (sal_uInt32)1 );
     165             :     }
     166           0 :     return nSize;
     167             : }
     168             : 
     169           0 : sal_uInt32 PPTWriter::ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pStrm )
     170             : {
     171           0 :     sal_uInt32 nSize = 111;
     172           0 :     if ( pStrm )
     173             :     {
     174           0 :         sal_uInt8 bShowGuides = 0;
     175           0 :         sal_uInt8 bSnapToGrid = 1;
     176           0 :         sal_uInt8 bSnapToShape = 0;
     177             : 
     178           0 :         sal_Int32 nScaling = 85;
     179           0 :         sal_Int32 nMasterCoordinate = 0xdda;
     180           0 :         sal_Int32 nXOrigin = -780;
     181           0 :         sal_Int32 nYOrigin = -84;
     182             : 
     183           0 :         sal_Int32 nPosition1 = 0x870;
     184           0 :         sal_Int32 nPosition2 = 0xb40;
     185             : 
     186           0 :         if ( nInstance )
     187             :         {
     188           0 :             bShowGuides = 1;
     189           0 :             nScaling = 0x3b;
     190           0 :             nMasterCoordinate = 0xf0c;
     191           0 :             nXOrigin = -1752;
     192           0 :             nYOrigin = -72;
     193           0 :             nPosition1 = 0xb40;
     194           0 :             nPosition2 = 0x870;
     195             :         }
     196           0 :         pStrm->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_SlideViewInfo << 16 ) | ( nInstance << 4 ) ) )
     197           0 :               .WriteUInt32( (sal_uInt32)( nSize - 8 ) )
     198           0 :               .WriteUInt32( (sal_uInt32)( EPP_SlideViewInfoAtom << 16 ) ).WriteUInt32( (sal_uInt32)3 )
     199           0 :               .WriteUChar( bShowGuides ).WriteUChar( bSnapToGrid ).WriteUChar( bSnapToShape )
     200           0 :               .WriteUInt32( (sal_uInt32)( EPP_ViewInfoAtom << 16 ) ).WriteUInt32( (sal_uInt32)52 )
     201           0 :               .WriteInt32( nScaling ).WriteInt32( (sal_Int32)100 ).WriteInt32( nScaling ).WriteInt32( (sal_Int32)100 )  // scaling atom - Keeps the current scale
     202           0 :               .WriteInt32( nScaling ).WriteInt32( (sal_Int32)100 ).WriteInt32( nScaling ).WriteInt32( (sal_Int32)100 )  // scaling atom - Keeps the previous scale
     203           0 :               .WriteInt32( (sal_Int32)0x17ac ).WriteInt32( nMasterCoordinate )// Origin - Keeps the origin in master coordinates
     204           0 :               .WriteInt32( nXOrigin ).WriteInt32( nYOrigin )              // Origin
     205           0 :               .WriteUChar( (sal_uInt8)1 )                          // Bool1 varScale - Set if zoom to fit is set
     206           0 :               .WriteUChar( (sal_uInt8)0 )                          // bool1 draftMode - Not used
     207           0 :               .WriteUInt16( (sal_uInt16)0 )                         // padword
     208           0 :               .WriteUInt32( (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) ).WriteUInt32( (sal_uInt32)8 )
     209           0 :               .WriteUInt32( (sal_uInt32)0 )     // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
     210           0 :               .WriteInt32( nPosition1 )    // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
     211           0 :               .WriteUInt32( (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) ).WriteUInt32( (sal_uInt32)8 )
     212           0 :               .WriteInt32( (sal_Int32)1 )      // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
     213           0 :               .WriteInt32( nPosition2 );   // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
     214             :     }
     215           0 :     return nSize;
     216             : }
     217             : 
     218           0 : sal_uInt32 PPTWriter::ImplOutlineViewInfoContainer( SvStream* pStrm )
     219             : {
     220           0 :     sal_uInt32 nSize = 68;
     221           0 :     if ( pStrm )
     222             :     {
     223           0 :         pStrm->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_OutlineViewInfo << 16 ) ) ).WriteUInt32( (sal_uInt32)( nSize - 8 ) )
     224           0 :               .WriteUInt32( (sal_uInt32)( EPP_ViewInfoAtom << 16 ) ).WriteUInt32( (sal_uInt32)52 )
     225           0 :               .WriteInt32( (sal_Int32)170 ).WriteInt32( (sal_Int32)200 ).WriteInt32( (sal_Int32)170 ).WriteInt32( (sal_Int32)200 )  // scaling atom - Keeps the current scale
     226           0 :               .WriteInt32( (sal_Int32)170 ).WriteInt32( (sal_Int32)200 ).WriteInt32( (sal_Int32)170 ).WriteInt32( (sal_Int32)200 )  // scaling atom - Keeps the previous scale
     227           0 :               .WriteInt32( (sal_Int32)0x17ac ).WriteInt32( (sal_Int32)0xdda )    // Origin - Keeps the origin in master coordinates
     228           0 :               .WriteInt32( (sal_Int32)-780 ).WriteInt32( (sal_Int32)-84 ) // Origin
     229           0 :               .WriteUChar( (sal_uInt8)1 )                  // bool1 varScale - Set if zoom to fit is set
     230           0 :               .WriteUChar( (sal_uInt8)0 )                  // bool1 draftMode - Not used
     231           0 :               .WriteUInt16( (sal_uInt16)0 );                // padword
     232             :     }
     233           0 :     return nSize;
     234             : }
     235             : 
     236           0 : sal_uInt32 PPTWriter::ImplProgBinaryTag( SvStream* pStrm )
     237             : {
     238           0 :     sal_uInt32 nPictureStreamSize, nOutlineStreamSize, nSize = 8;
     239             : 
     240           0 :     nPictureStreamSize = aBuExPictureStream.Tell();
     241           0 :     if ( nPictureStreamSize )
     242           0 :         nSize += nPictureStreamSize + 8;
     243             : 
     244           0 :     nOutlineStreamSize = aBuExOutlineStream.Tell();
     245           0 :     if ( nOutlineStreamSize )
     246           0 :         nSize += nOutlineStreamSize + 8;
     247             : 
     248           0 :     if ( pStrm )
     249             :     {
     250           0 :         pStrm->WriteUInt32( (sal_uInt32)( EPP_BinaryTagData << 16 ) ).WriteUInt32( (sal_uInt32)( nSize - 8 ) );
     251           0 :         if ( nPictureStreamSize )
     252             :         {
     253           0 :             pStrm->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_PST_ExtendedBuGraContainer << 16 ) ) ).WriteUInt32( nPictureStreamSize );
     254           0 :             pStrm->Write( aBuExPictureStream.GetData(), nPictureStreamSize );
     255             :         }
     256           0 :         if ( nOutlineStreamSize )
     257             :         {
     258           0 :             pStrm->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_PST_ExtendedPresRuleContainer << 16 ) ) ).WriteUInt32( nOutlineStreamSize );
     259           0 :             pStrm->Write( aBuExOutlineStream.GetData(), nOutlineStreamSize );
     260             :         }
     261             :     }
     262           0 :     return nSize;
     263             : }
     264             : 
     265           0 : sal_uInt32 PPTWriter::ImplProgBinaryTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
     266             : {
     267           0 :     sal_uInt32 nSize = 8 + 8 + 14;
     268           0 :     if ( pStrm )
     269             :     {
     270           0 :         pStrm->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_ProgBinaryTag << 16 ) ) ).WriteUInt32( (sal_uInt32)0 )
     271           0 :               .WriteUInt32( (sal_uInt32)( EPP_CString << 16 ) ).WriteUInt32( (sal_uInt32)14 )
     272           0 :               .WriteUInt32( (sal_uInt32)0x5f005f ).WriteUInt32( (sal_uInt32)0x50005f )
     273           0 :               .WriteUInt32( (sal_uInt32)0x540050 ).WriteUInt16( (sal_uInt16)0x39 );
     274             :     }
     275           0 :     if ( pStrm && pBinTagStrm )
     276             :     {
     277           0 :         sal_uInt32 nLen = pBinTagStrm->Tell();
     278           0 :         nSize += nLen + 8;
     279           0 :         pStrm->WriteUInt32( (sal_uInt32)( EPP_BinaryTagData << 16 ) ).WriteUInt32( nLen );
     280           0 :         pStrm->Write( pBinTagStrm->GetData(), nLen );
     281             :     }
     282             :     else
     283           0 :         nSize += ImplProgBinaryTag( pStrm );
     284             : 
     285           0 :     if ( pStrm )
     286             :     {
     287           0 :         pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
     288           0 :         pStrm->WriteUInt32( (sal_uInt32)( nSize - 8 ) );
     289           0 :         pStrm->SeekRel( nSize - 8 );
     290             :     }
     291           0 :     return nSize;
     292             : }
     293             : 
     294           0 : sal_uInt32 PPTWriter::ImplProgTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
     295             : {
     296           0 :     sal_uInt32 nSize = 0;
     297           0 :     if ( aBuExPictureStream.Tell() || aBuExOutlineStream.Tell() || pBinTagStrm )
     298             :     {
     299           0 :         nSize = 8;
     300           0 :         if ( pStrm )
     301             :         {
     302           0 :             pStrm->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_ProgTags << 16 ) ) ).WriteUInt32( (sal_uInt32)0 );
     303             :         }
     304           0 :         nSize += ImplProgBinaryTagContainer( pStrm, pBinTagStrm );
     305           0 :         if ( pStrm )
     306             :         {
     307           0 :             pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
     308           0 :             pStrm->WriteUInt32( (sal_uInt32)( nSize - 8 ) );
     309           0 :             pStrm->SeekRel( nSize - 8 );
     310             :         }
     311             :     }
     312           0 :     return nSize;
     313             : }
     314             : 
     315           0 : sal_uInt32 PPTWriter::ImplDocumentListContainer( SvStream* pStrm )
     316             : {
     317           0 :     sal_uInt32 nSize = 8;
     318           0 :     if ( pStrm )
     319             :     {
     320           0 :         pStrm->WriteUInt32( (sal_uInt32)( ( EPP_List << 16 ) | 0xf ) ).WriteUInt32( (sal_uInt32)0 );
     321             :     }
     322             : 
     323           0 :     nSize += ImplVBAInfoContainer( pStrm );
     324           0 :     nSize += ImplSlideViewInfoContainer( 0, pStrm );
     325           0 :     nSize += ImplOutlineViewInfoContainer( pStrm );
     326           0 :     nSize += ImplSlideViewInfoContainer( 1, pStrm );
     327           0 :     nSize += ImplProgTagContainer( pStrm );
     328             : 
     329           0 :     if ( pStrm )
     330             :     {
     331           0 :         pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
     332           0 :         pStrm->WriteUInt32( (sal_uInt32)( nSize - 8 ) );
     333           0 :         pStrm->SeekRel( nSize - 8 );
     334             :     }
     335           0 :     return nSize;
     336             : }
     337             : 
     338           0 : sal_uInt32 PPTWriter::ImplMasterSlideListContainer( SvStream* pStrm )
     339             : {
     340           0 :     sal_uInt32 i, nSize = 28 * mnMasterPages + 8;
     341           0 :     if ( pStrm )
     342             :     {
     343           0 :         pStrm->WriteUInt32( (sal_uInt32)( 0x1f | ( EPP_SlideListWithText << 16 ) ) ).WriteUInt32( (sal_uInt32)( nSize - 8 ) );
     344             : 
     345           0 :         for ( i = 0; i < mnMasterPages; i++ )
     346             :         {
     347           0 :             pStrm->WriteUInt32( (sal_uInt32)( EPP_SlidePersistAtom << 16 ) ).WriteUInt32( (sal_uInt32)20 );
     348           0 :             mpPptEscherEx->InsertPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, pStrm->Tell() );
     349           0 :             pStrm->WriteUInt32( (sal_uInt32)0 )                 // psrReference - logical reference to the slide persist object ( EPP_MAINMASTER_PERSIST_KEY )
     350           0 :                   .WriteUInt32( (sal_uInt32)0 )                 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
     351           0 :                   .WriteInt32( (sal_Int32)0 )                  // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
     352           0 :                   .WriteInt32( (sal_Int32)( 0x80000000 | i ) ) // slideId - Unique slide identifier, used for OLE link monikers for example
     353           0 :                   .WriteUInt32( (sal_uInt32)0 );                // reserved, usualy 0
     354             :         }
     355             :     }
     356           0 :     return nSize;
     357             : }
     358             : 
     359           0 : sal_uInt32 PPTWriter::ImplInsertBookmarkURL( const OUString& rBookmarkURL, const sal_uInt32 nType,
     360             :     const OUString& rStringVer0, const OUString& rStringVer1, const OUString& rStringVer2, const OUString& rStringVer3 )
     361             : {
     362           0 :     sal_uInt32 nHyperId = ++mnExEmbed;
     363             : 
     364           0 :     OUString sBookmarkURL( rBookmarkURL );
     365           0 :     INetURLObject aBaseURI( maBaseURI );
     366           0 :     INetURLObject aBookmarkURI( rBookmarkURL );
     367           0 :     if( aBaseURI.GetProtocol() == aBookmarkURI.GetProtocol() )
     368             :     {
     369             :         OUString aRelUrl( INetURLObject::GetRelURL( maBaseURI, rBookmarkURL,
     370           0 :            INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI, RTL_TEXTENCODING_UTF8, INetURLObject::FSYS_DETECT ) );
     371           0 :         if ( !aRelUrl.isEmpty() )
     372           0 :             sBookmarkURL = aRelUrl;
     373             :     }
     374           0 :     maHyperlink.push_back( EPPTHyperlink( sBookmarkURL, nType ) );
     375             : 
     376           0 :     mpExEmbed->WriteUInt16( (sal_uInt16)0xf )
     377           0 :                .WriteUInt16( (sal_uInt16)EPP_ExHyperlink )
     378           0 :                .WriteUInt32( (sal_uInt32)0 );
     379           0 :     sal_uInt32 nHyperSize, nHyperStart = mpExEmbed->Tell();
     380           0 :     mpExEmbed->WriteUInt16( (sal_uInt16)0 )
     381           0 :                .WriteUInt16( (sal_uInt16)EPP_ExHyperlinkAtom )
     382           0 :                .WriteUInt32( (sal_uInt32)4 )
     383           0 :                .WriteUInt32( nHyperId );
     384             : 
     385           0 :     PPTWriter::WriteCString( *mpExEmbed, rStringVer0, 0 );
     386           0 :     PPTWriter::WriteCString( *mpExEmbed, rStringVer1, 1 );
     387           0 :     PPTWriter::WriteCString( *mpExEmbed, rStringVer2, 2 );
     388           0 :     PPTWriter::WriteCString( *mpExEmbed, rStringVer3, 3 );
     389             : 
     390           0 :     nHyperSize = mpExEmbed->Tell() - nHyperStart;
     391           0 :     mpExEmbed->SeekRel( - ( (sal_Int32)nHyperSize + 4 ) );
     392           0 :     mpExEmbed->WriteUInt32( nHyperSize );
     393           0 :     mpExEmbed->SeekRel( nHyperSize );
     394           0 :     return nHyperId;
     395             : }
     396             : 
     397           0 : sal_Bool PPTWriter::ImplCloseDocument()
     398             : {
     399           0 :     sal_uInt32 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Document );
     400           0 :     if ( nOfs )
     401             :     {
     402           0 :         mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_CurrentPos, mpStrm->Tell() );
     403           0 :         mpStrm->Seek( nOfs );
     404             : 
     405             :         // creating the TxMasterStyleAtom
     406           0 :         SvMemoryStream aTxMasterStyleAtomStrm( 0x200, 0x200 );
     407             :         {
     408           0 :             EscherExAtom aTxMasterStyleAtom( aTxMasterStyleAtomStrm, EPP_TxMasterStyleAtom, EPP_TEXTTYPE_Other );
     409           0 :             aTxMasterStyleAtomStrm.WriteUInt16( (sal_uInt16)5 );        // paragraph count
     410             :             sal_uInt16 nLev;
     411           0 :             sal_Bool bFirst = sal_True;
     412           0 :             for ( nLev = 0; nLev < 5; nLev++ )
     413             :             {
     414           0 :                 mpStyleSheet->mpParaSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
     415           0 :                 mpStyleSheet->mpCharSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
     416           0 :                 bFirst = sal_False;
     417           0 :             }
     418             :         }
     419             : 
     420           0 :         mpExEmbed->Seek( STREAM_SEEK_TO_END );
     421           0 :         sal_uInt32 nExEmbedSize = mpExEmbed->Tell();
     422             : 
     423             :         // nEnviroment : whole size of the environment container
     424           0 :         sal_uInt32 nEnvironment = maFontCollection.GetCount() * 76      // 68 bytes per Fontenityatom and 8 Bytes per header
     425             :                                 + 8                                     // 1 FontCollection container
     426             :                                 + 20                                    // SrKinsoku container
     427             :                                 + 18                                    // 1 TxSiStyleAtom
     428           0 :                                 + aTxMasterStyleAtomStrm.Tell()         // 1 TxMasterStyleAtom;
     429           0 :                                 + mpStyleSheet->SizeOfTxCFStyleAtom();
     430             : 
     431           0 :         sal_uInt32 nBytesToInsert = nEnvironment + 8;
     432             : 
     433           0 :         if ( nExEmbedSize )
     434           0 :             nBytesToInsert += nExEmbedSize + 8 + 12;
     435             : 
     436           0 :         nBytesToInsert += maSoundCollection.GetSize();
     437           0 :         nBytesToInsert += mpPptEscherEx->DrawingGroupContainerSize();
     438           0 :         nBytesToInsert += ImplMasterSlideListContainer( NULL );
     439           0 :         nBytesToInsert += ImplDocumentListContainer( NULL );
     440             : 
     441             :         // insert nBytes into stream and adjust depending container
     442           0 :         mpPptEscherEx->InsertAtCurrentPos( nBytesToInsert, false );
     443             : 
     444             :         // CREATE HYPERLINK CONTAINER
     445           0 :         if ( nExEmbedSize )
     446             :         {
     447           0 :             mpStrm->WriteUInt16( (sal_uInt16)0xf )
     448           0 :                    .WriteUInt16( (sal_uInt16)EPP_ExObjList )
     449           0 :                    .WriteUInt32( (sal_uInt32)( nExEmbedSize + 12 ) )
     450           0 :                    .WriteUInt16( (sal_uInt16)0 )
     451           0 :                    .WriteUInt16( (sal_uInt16)EPP_ExObjListAtom )
     452           0 :                    .WriteUInt32( (sal_uInt32)4 )
     453           0 :                    .WriteUInt32( (sal_uInt32)mnExEmbed );
     454           0 :             mpPptEscherEx->InsertPersistOffset( EPP_Persist_ExObj, mpStrm->Tell() );
     455           0 :             mpStrm->Write( mpExEmbed->GetData(), nExEmbedSize );
     456             :         }
     457             : 
     458             :         // CREATE ENVIRONMENT
     459           0 :         mpStrm->WriteUInt16( (sal_uInt16)0xf ).WriteUInt16( (sal_uInt16)EPP_Environment ).WriteUInt32( (sal_uInt32)nEnvironment );
     460             : 
     461             :         // Open Container ( EPP_SrKinsoku )
     462           0 :         mpStrm->WriteUInt16( (sal_uInt16)0x2f ).WriteUInt16( (sal_uInt16)EPP_SrKinsoku ).WriteUInt32( (sal_uInt32)12 );
     463           0 :         mpPptEscherEx->AddAtom( 4, EPP_SrKinsokuAtom, 0, 3 );
     464           0 :         mpStrm->WriteInt32( (sal_Int32)0 );                        // SrKinsoku Level 0
     465             : 
     466             :         // Open Container ( EPP_FontCollection )
     467           0 :         mpStrm->WriteUInt16( (sal_uInt16)0xf ).WriteUInt16( (sal_uInt16)EPP_FontCollection ).WriteUInt32( (sal_uInt32)maFontCollection.GetCount() * 76 );
     468             : 
     469           0 :         for ( sal_uInt32 i = 0; i < maFontCollection.GetCount(); i++ )
     470             :         {
     471           0 :             mpPptEscherEx->AddAtom( 68, EPP_FontEnityAtom, 0, i );
     472           0 :             const FontCollectionEntry* pDesc = maFontCollection.GetById( i );
     473           0 :             sal_Int32 nFontLen = pDesc->Name.getLength();
     474           0 :             if ( nFontLen > 31 )
     475           0 :                 nFontLen = 31;
     476           0 :             for ( sal_Int32 n = 0; n < 32; n++ )
     477             :             {
     478           0 :                 sal_Unicode nUniCode = 0;
     479           0 :                 if ( n < nFontLen )
     480           0 :                     nUniCode = pDesc->Name[n];
     481           0 :                 mpStrm->WriteUInt16( nUniCode );
     482             :             }
     483           0 :             sal_uInt8   lfCharSet = ANSI_CHARSET;
     484           0 :             sal_uInt8   lfClipPrecision = 0;
     485           0 :             sal_uInt8   lfQuality = 6;
     486           0 :             sal_uInt8   lfPitchAndFamily = 0;
     487             : 
     488           0 :             if ( pDesc->CharSet == RTL_TEXTENCODING_SYMBOL )
     489           0 :                 lfCharSet = SYMBOL_CHARSET;
     490             : 
     491           0 :             switch( pDesc->Family )
     492             :             {
     493             :                 case ::com::sun::star::awt::FontFamily::ROMAN :
     494           0 :                     lfPitchAndFamily |= FF_ROMAN;
     495           0 :                 break;
     496             : 
     497             :                 case ::com::sun::star::awt::FontFamily::SWISS :
     498           0 :                     lfPitchAndFamily |= FF_SWISS;
     499           0 :                 break;
     500             : 
     501             :                 case ::com::sun::star::awt::FontFamily::MODERN :
     502           0 :                     lfPitchAndFamily |= FF_MODERN;
     503           0 :                 break;
     504             : 
     505             :                 case ::com::sun::star::awt::FontFamily::SCRIPT:
     506           0 :                     lfPitchAndFamily |= FF_SCRIPT;
     507           0 :                 break;
     508             : 
     509             :                 case ::com::sun::star::awt::FontFamily::DECORATIVE:
     510           0 :                      lfPitchAndFamily |= FF_DECORATIVE;
     511           0 :                 break;
     512             : 
     513             :                 default:
     514           0 :                     lfPitchAndFamily |= FAMILY_DONTKNOW;
     515           0 :                 break;
     516             :             }
     517           0 :             switch( pDesc->Pitch )
     518             :             {
     519             :                 case ::com::sun::star::awt::FontPitch::FIXED:
     520           0 :                     lfPitchAndFamily |= FIXED_PITCH;
     521           0 :                 break;
     522             : 
     523             :                 default:
     524           0 :                     lfPitchAndFamily |= DEFAULT_PITCH;
     525           0 :                 break;
     526             :             }
     527           0 :             mpStrm->WriteUChar( lfCharSet )
     528           0 :                    .WriteUChar( lfClipPrecision )
     529           0 :                    .WriteUChar( lfQuality )
     530           0 :                    .WriteUChar( lfPitchAndFamily );
     531             :         }
     532           0 :         mpStyleSheet->WriteTxCFStyleAtom( *mpStrm );        // create style that is used for new standard objects
     533           0 :         mpPptEscherEx->AddAtom( 10, EPP_TxSIStyleAtom );
     534           0 :         mpStrm->WriteUInt32( (sal_uInt32)7 )                        // ?
     535           0 :                .WriteInt16( (sal_Int16)2 )                         // ?
     536           0 :                .WriteUChar( (sal_uInt8)9 )                         // ?
     537           0 :                .WriteUChar( (sal_uInt8)8 )                         // ?
     538           0 :                .WriteInt16( (sal_Int16)0 );                        // ?
     539             : 
     540           0 :         mpStrm->Write( aTxMasterStyleAtomStrm.GetData(), aTxMasterStyleAtomStrm.Tell() );
     541           0 :         maSoundCollection.Write( *mpStrm );
     542           0 :         mpPptEscherEx->WriteDrawingGroupContainer( *mpStrm );
     543           0 :         ImplMasterSlideListContainer( mpStrm );
     544           0 :         ImplDocumentListContainer( mpStrm );
     545             : 
     546           0 :         sal_uInt32 nOldPos = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_CurrentPos );
     547           0 :         if ( nOldPos )
     548             :         {
     549           0 :             mpStrm->Seek( nOldPos );
     550           0 :             return sal_True;
     551           0 :         }
     552             :     }
     553           0 :     return sal_False;
     554             : }
     555             : 
     556           0 : sal_Bool PropValue::GetPropertyValue(
     557             :     ::com::sun::star::uno::Any& rAny,
     558             :     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
     559             :     const OUString& rString,
     560             :     sal_Bool bTestPropertyAvailability )
     561             : {
     562           0 :     sal_Bool bRetValue = sal_True;
     563           0 :     if ( bTestPropertyAvailability )
     564             :     {
     565           0 :         bRetValue = sal_False;
     566             :         try
     567             :         {
     568             :             ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     569           0 :                 aXPropSetInfo( rXPropSet->getPropertySetInfo() );
     570           0 :             if ( aXPropSetInfo.is() )
     571           0 :                 bRetValue = aXPropSetInfo->hasPropertyByName( rString );
     572             :         }
     573           0 :         catch( ::com::sun::star::uno::Exception& )
     574             :         {
     575           0 :             bRetValue = sal_False;
     576             :         }
     577             :     }
     578           0 :     if ( bRetValue )
     579             :     {
     580             :         try
     581             :         {
     582           0 :             rAny = rXPropSet->getPropertyValue( rString );
     583           0 :             if ( !rAny.hasValue() )
     584           0 :                 bRetValue = sal_False;
     585             :         }
     586           0 :         catch( ::com::sun::star::uno::Exception& )
     587             :         {
     588           0 :             bRetValue = sal_False;
     589             :         }
     590             :     }
     591           0 :     return bRetValue;
     592             : }
     593             : 
     594           0 : ::com::sun::star::beans::PropertyState PropValue::GetPropertyState(
     595             :     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
     596             :     const OUString& rPropertyName )
     597             : {
     598           0 :     ::com::sun::star::beans::PropertyState eRetValue = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
     599             :     try
     600             :     {
     601             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > aXPropState
     602           0 :                 ( rXPropSet, ::com::sun::star::uno::UNO_QUERY );
     603           0 :         if ( aXPropState.is() )
     604           0 :             eRetValue = aXPropState->getPropertyState( rPropertyName );
     605             :     }
     606           0 :     catch( ::com::sun::star::uno::Exception& )
     607             :     {
     608             : 
     609             :     }
     610           0 :     return eRetValue;
     611             : }
     612             : 
     613           0 : sal_Bool PropValue::ImplGetPropertyValue( const OUString& rString )
     614             : {
     615           0 :     return GetPropertyValue( mAny, mXPropSet, rString );
     616             : }
     617             : 
     618           0 : sal_Bool PropValue::ImplGetPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & aXPropSet, const OUString& rString )
     619             : {
     620           0 :     return GetPropertyValue( mAny, aXPropSet, rString );
     621             : }
     622             : 
     623           0 : sal_Bool PropStateValue::ImplGetPropertyValue( const OUString& rString, sal_Bool bGetPropertyState )
     624             : {
     625           0 :     ePropState = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
     626           0 :     sal_Bool bRetValue = sal_True;
     627             : #ifdef UNX
     628             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     629           0 :             aXPropSetInfo( mXPropSet->getPropertySetInfo() );
     630           0 :         if ( !aXPropSetInfo.is() )
     631           0 :             return sal_False;
     632             : #endif
     633             :     try
     634             :     {
     635           0 :         mAny = mXPropSet->getPropertyValue( rString );
     636           0 :         if ( !mAny.hasValue() )
     637           0 :             bRetValue = sal_False;
     638           0 :         else if ( bGetPropertyState )
     639           0 :             ePropState = mXPropState->getPropertyState( rString );
     640             :         else
     641           0 :             ePropState = ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
     642             :     }
     643           0 :     catch( ::com::sun::star::uno::Exception& )
     644             :     {
     645           0 :         bRetValue = sal_False;
     646             :     }
     647           0 :     return bRetValue;
     648             : }
     649             : 
     650           0 : void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
     651             : {
     652           0 :     sal_Bool            bFirstParagraph = sal_True;
     653             :     sal_uInt32          nCharCount;
     654           0 :     sal_uInt32          nPropertyFlags = 0;
     655           0 :     sal_uInt16          nDepth = 0;
     656             :     sal_Int16           nLineSpacing;
     657           0 :     int                 nInstance = rTextObj.GetInstance();
     658             : 
     659           0 :     for ( sal_uInt32 i = 0;  i < rTextObj.ParagraphCount(); ++i, bFirstParagraph = sal_False )
     660             :     {
     661           0 :         ParagraphObj* pPara = rTextObj.GetParagraph(i);
     662           0 :         PortionObj* pPortion = pPara->front();
     663           0 :         nCharCount = pPara->CharacterCount();
     664             : 
     665           0 :         nDepth = pPara->nDepth;
     666           0 :         if ( nDepth > 4)
     667           0 :             nDepth = 4;
     668             : 
     669           0 :         if ( ( pPara->meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     670           0 :             ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_Adjust, pPara->mnTextAdjust ) ) )
     671           0 :             nPropertyFlags |= 0x00000800;
     672           0 :         nLineSpacing = pPara->mnLineSpacing;
     673             : 
     674           0 :         const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
     675           0 :         sal_Int16 nNormalSpacing = 100;
     676           0 :         if ( !mbFontIndependentLineSpacing && pDesc )
     677             :         {
     678           0 :             double fN = 100.0;
     679           0 :             fN *= pDesc->Scaling;
     680           0 :             nNormalSpacing = (sal_Int16)( fN + 0.5 );
     681             :         }
     682           0 :         if ( !mbFontIndependentLineSpacing && bFirstParagraph && ( nLineSpacing > nNormalSpacing ) )    // sj: i28747, no replacement for fixed linespacing
     683             :         {
     684           0 :             nLineSpacing = nNormalSpacing;
     685           0 :             nPropertyFlags |= 0x00001000;
     686             :         }
     687             :         else
     688             :         {
     689           0 :             if ( nLineSpacing > 0 )
     690             :             {
     691           0 :                 if ( !mbFontIndependentLineSpacing && pDesc )
     692           0 :                      nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
     693             :             }
     694             :             else
     695             :             {
     696           0 :                 if ( !pPara->mbFixedLineSpacing && pPortion->mnCharHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
     697           0 :                     nLineSpacing = nNormalSpacing;
     698             :                 else
     699           0 :                     nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
     700             :             }
     701           0 :             if ( ( pPara->meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     702           0 :                 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LineFeed, nLineSpacing ) ) )
     703           0 :                 nPropertyFlags |= 0x00001000;
     704             :         }
     705           0 :         if ( ( pPara->meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     706           0 :             ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mnLineSpacingTop ) ) )
     707           0 :             nPropertyFlags |= 0x00002000;
     708           0 :         if ( ( pPara->meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     709           0 :             ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LowerDist, pPara->mnLineSpacingBottom ) ) )
     710           0 :             nPropertyFlags |= 0x00004000;
     711           0 :         if ( ( pPara->meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     712           0 :             ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbForbiddenRules ) ) )
     713           0 :             nPropertyFlags |= 0x00020000;
     714           0 :         if ( ( pPara->meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     715           0 :             ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbParagraphPunctation ) ) )
     716           0 :             nPropertyFlags |= 0x00080000;
     717           0 :         if ( ( pPara->meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     718           0 :             ( mpStyleSheet->IsHardAttribute( nInstance, nDepth, ParaAttr_BiDi, pPara->mnBiDi ) ) )
     719           0 :             nPropertyFlags |= 0x00200000;
     720             : 
     721           0 :         sal_Int32 nBuRealSize = pPara->nBulletRealSize;
     722           0 :         sal_Int16 nBulletFlags = pPara->nBulletFlags;
     723             : 
     724           0 :         if ( pPara->bExtendedParameters )
     725           0 :             nPropertyFlags |= pPara->nParaFlags;
     726             :         else
     727             :         {
     728           0 :             nPropertyFlags |= 1;            // turn off bullet explicit
     729           0 :             nBulletFlags = 0;
     730             :         }
     731             : 
     732             :         // Write nTextOfs and nBullets
     733           0 :         if ( mpStyleSheet->IsHardAttribute( nInstance, nDepth, ParaAttr_TextOfs, pPara->nTextOfs ) )
     734           0 :             nPropertyFlags |= 0x100;
     735           0 :         if ( mpStyleSheet->IsHardAttribute( nInstance, nDepth, ParaAttr_BulletOfs, pPara->nBulletOfs ))
     736           0 :             nPropertyFlags |= 0x400;
     737             : 
     738           0 :         FontCollectionEntry aFontDescEntry( pPara->aFontDesc.Name, pPara->aFontDesc.Family, pPara->aFontDesc.Pitch, pPara->aFontDesc.CharSet );
     739           0 :         sal_uInt16  nFontId = (sal_uInt16)maFontCollection.GetId( aFontDescEntry );
     740             : 
     741           0 :         rOut.WriteUInt32( nCharCount )
     742           0 :             .WriteUInt16( nDepth )                          // Level
     743           0 :             .WriteUInt32( (sal_uInt32)nPropertyFlags );     // Paragraph Attribut Set
     744             : 
     745           0 :         if ( nPropertyFlags & 0xf )
     746           0 :             rOut.WriteInt16( nBulletFlags );
     747           0 :         if ( nPropertyFlags & 0x80 )
     748           0 :             rOut.WriteUInt16( (sal_uInt16)( pPara->cBulletId ) );
     749           0 :         if ( nPropertyFlags & 0x10 )
     750           0 :             rOut.WriteUInt16( nFontId );
     751           0 :         if ( nPropertyFlags & 0x40 )
     752           0 :             rOut.WriteInt16( (sal_Int16)nBuRealSize );
     753           0 :         if ( nPropertyFlags & 0x20 )
     754             :         {
     755           0 :             sal_uInt32 nBulletColor = pPara->nBulletColor;
     756           0 :             if ( nBulletColor == COL_AUTO )
     757             :             {
     758           0 :                 sal_Bool bIsDark = sal_False;
     759           0 :                 ::com::sun::star::uno::Any aAny;
     760           0 :                 if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, OUString( "IsBackgroundDark" ), sal_True ) )
     761           0 :                     aAny >>= bIsDark;
     762           0 :                 nBulletColor = bIsDark ? 0xffffff : 0x000000;
     763             :             }
     764           0 :             nBulletColor &= 0xffffff;
     765           0 :             nBulletColor |= 0xfe000000;
     766           0 :             rOut.WriteUInt32( nBulletColor );
     767             :         }
     768           0 :         if ( nPropertyFlags & 0x00000800 )
     769           0 :             rOut.WriteUInt16( (sal_uInt16)( pPara->mnTextAdjust ) );
     770           0 :         if ( nPropertyFlags & 0x00001000 )
     771           0 :             rOut.WriteUInt16( (sal_uInt16)( nLineSpacing ) );
     772           0 :         if ( nPropertyFlags & 0x00002000 )
     773           0 :             rOut.WriteUInt16( (sal_uInt16)( pPara->mnLineSpacingTop ) );
     774           0 :         if ( nPropertyFlags & 0x00004000 )
     775           0 :             rOut.WriteUInt16( (sal_uInt16)( pPara->mnLineSpacingBottom ) );
     776           0 :         if ( nPropertyFlags & 0x100 )
     777           0 :             rOut.WriteUInt16( (sal_uInt16)(pPara->nTextOfs) );
     778           0 :         if (  nPropertyFlags & 0x400 )
     779           0 :             rOut.WriteUInt16( (sal_uInt16)(pPara->nBulletOfs) );
     780           0 :         if ( nPropertyFlags & 0x000e0000 )
     781             :         {
     782           0 :             sal_uInt16 nAsianSettings = 0;
     783           0 :             if ( pPara->mbForbiddenRules )
     784           0 :                 nAsianSettings |= 1;
     785           0 :             if ( pPara->mbParagraphPunctation )
     786           0 :                 nAsianSettings |= 4;
     787           0 :             rOut.WriteUInt16( nAsianSettings );
     788             :         }
     789           0 :         if ( nPropertyFlags & 0x200000 )
     790           0 :             rOut.WriteUInt16( pPara->mnBiDi );
     791           0 :     }
     792           0 : }
     793             : 
     794           0 : void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
     795             : {
     796             :     sal_uInt32  nPropertyFlags;
     797           0 :     int nInstance = rTextObj.GetInstance();
     798             : 
     799           0 :     for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i )
     800             :     {
     801           0 :         ParagraphObj* pPara = rTextObj.GetParagraph(i);
     802           0 :         for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
     803             :         {
     804           0 :             PortionObj* pPortion = *it;
     805           0 :             nPropertyFlags = 0;
     806           0 :             sal_uInt32 nCharAttr = pPortion->mnCharAttr;
     807           0 :             sal_uInt32 nCharColor = pPortion->mnCharColor;
     808             : 
     809           0 :             if ( nCharColor == COL_AUTO )   // nCharColor depends to the background color
     810             :             {
     811           0 :                 sal_Bool bIsDark = sal_False;
     812           0 :                 ::com::sun::star::uno::Any aAny;
     813           0 :                 if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, OUString( "IsBackgroundDark" ), sal_True ) )
     814           0 :                     aAny >>= bIsDark;
     815           0 :                 nCharColor = bIsDark ? 0xffffff : 0x000000;
     816             :             }
     817             : 
     818           0 :             nCharColor &= 0xffffff;
     819             : 
     820             :             /* the portion is using the embossed or engraved attribute, which we want to map to the relief feature of PPT.
     821             :             Because the relief feature of PPT is dependent to the background color, such a mapping can not always be used. */
     822           0 :             if ( nCharAttr & 0x200 )
     823             :             {
     824           0 :                 sal_uInt32 nBackgroundColor = 0xffffff;
     825             : 
     826           0 :                 if ( !nCharColor )          // special threatment for
     827           0 :                     nCharColor = 0xffffff;  // black fontcolor
     828             : 
     829           0 :                 ::com::sun::star::uno::Any aAny;
     830           0 :                 ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
     831           0 :                 if ( PropValue::GetPropertyValue( aAny, mXPropSet, OUString( "FillStyle" ) ) )
     832           0 :                     aAny >>= aFS;
     833           0 :                 switch( aFS )
     834             :                 {
     835             :                     case ::com::sun::star::drawing::FillStyle_GRADIENT :
     836             :                     {
     837           0 :                         Point aEmptyPoint = Point();
     838           0 :                         Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
     839           0 :                         EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
     840           0 :                         aPropOpt.CreateGradientProperties( mXPropSet );
     841           0 :                         aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
     842             :                     }
     843           0 :                     break;
     844             :                     case ::com::sun::star::drawing::FillStyle_SOLID :
     845             :                     {
     846           0 :                         if ( PropValue::GetPropertyValue( aAny, mXPropSet, OUString( "FillColor" ) ) )
     847           0 :                             nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
     848             :                     }
     849           0 :                     break;
     850             :                     case ::com::sun::star::drawing::FillStyle_NONE :
     851             :                     {
     852           0 :                         ::com::sun::star::uno::Any aBackAny;
     853           0 :                         ::com::sun::star::drawing::FillStyle aBackFS( ::com::sun::star::drawing::FillStyle_NONE );
     854           0 :                         if ( PropValue::GetPropertyValue( aBackAny, mXBackgroundPropSet, OUString( "FillStyle" ) ) )
     855           0 :                             aBackAny >>= aBackFS;
     856           0 :                         switch( aBackFS )
     857             :                         {
     858             :                             case ::com::sun::star::drawing::FillStyle_GRADIENT :
     859             :                             {
     860           0 :                                 Point aEmptyPoint = Point();
     861           0 :                                 Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
     862           0 :                                 EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
     863           0 :                                 aPropOpt.CreateGradientProperties( mXBackgroundPropSet );
     864           0 :                                 aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
     865             :                             }
     866           0 :                             break;
     867             :                             case ::com::sun::star::drawing::FillStyle_SOLID :
     868             :                             {
     869           0 :                                 if ( PropValue::GetPropertyValue( aAny, mXBackgroundPropSet, OUString( "FillColor" ) ) )
     870           0 :                                     nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
     871             :                             }
     872           0 :                             break;
     873             :                             default:
     874           0 :                                 break;
     875           0 :                         }
     876             :                     }
     877           0 :                     break;
     878             :                     default:
     879           0 :                         break;
     880             :                 }
     881             : 
     882           0 :                 sal_Int32 nB = nBackgroundColor & 0xff;
     883           0 :                 nB += (sal_uInt8)( nBackgroundColor >> 8  );
     884           0 :                 nB += (sal_uInt8)( nBackgroundColor >> 16 );
     885             :                 // if the background color is nearly black, relief can't been used, because the text would not be visible
     886           0 :                 if ( nB < 0x60 || ( nBackgroundColor != nCharColor ) )
     887             :                 {
     888           0 :                     nCharAttr &=~ 0x200;
     889             : 
     890             :                     // now check if the text is part of a group, and if the previous object has the same color than the fontcolor
     891             :                     // ( and if fillcolor is not available the background color ), it is sometimes
     892             :                     // not possible to export the 'embossed' flag
     893           0 :                     if ( ( GetCurrentGroupLevel() > 0 ) && ( GetCurrentGroupIndex() >= 1 ) )
     894             :                     {
     895           0 :                         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aGroupedShape( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() - 1 ), uno::UNO_QUERY );
     896           0 :                         if( aGroupedShape.is() )
     897             :                         {
     898             :                             ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aPropSetOfNextShape
     899           0 :                                 ( aGroupedShape, ::com::sun::star::uno::UNO_QUERY );
     900           0 :                             if ( aPropSetOfNextShape.is() )
     901             :                             {
     902           0 :                                 if ( PropValue::GetPropertyValue( aAny, aPropSetOfNextShape,
     903           0 :                                                     OUString( "FillColor" ), sal_True ) )
     904             :                                 {
     905           0 :                                     if ( nCharColor == mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) ) )
     906             :                                     {
     907           0 :                                         nCharAttr |= 0x200;
     908             :                                     }
     909             :                                 }
     910           0 :                             }
     911           0 :                         }
     912             :                     }
     913           0 :                 }
     914             :             }
     915           0 :             nCharColor |= 0xfe000000;
     916           0 :             if ( nInstance == 4 )                       // special handling for normal textobjects:
     917           0 :                 nPropertyFlags |= nCharAttr & 0x217;    // not all attributes ar inherited
     918             :             else
     919             :             {
     920           0 :                 if ( /* ( pPortion->mnCharAttrHard & 1 ) || */
     921           0 :                     ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Bold, nCharAttr ) ) )
     922           0 :                     nPropertyFlags |= 1;
     923           0 :                 if ( /* ( pPortion->mnCharAttrHard & 2 ) || */
     924           0 :                     ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Italic, nCharAttr ) ) )
     925           0 :                     nPropertyFlags |= 2;
     926           0 :                 if ( /* ( pPortion->mnCharAttrHard & 4 ) || */
     927           0 :                     ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Underline, nCharAttr ) ) )
     928           0 :                     nPropertyFlags |= 4;
     929           0 :                 if ( /* ( pPortion->mnCharAttrHard & 0x10 ) || */
     930           0 :                     ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Shadow, nCharAttr ) ) )
     931           0 :                     nPropertyFlags |= 0x10;
     932           0 :                 if ( /* ( pPortion->mnCharAttrHard & 0x200 ) || */
     933           0 :                     ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Embossed, nCharAttr ) ) )
     934           0 :                     nPropertyFlags |= 512;
     935             :             }
     936           0 :             if ( rTextObj.HasExtendedBullets() )
     937             :             {
     938           0 :                 nPropertyFlags |= ( i & 0x3f ) << 10 ;
     939           0 :                 nCharAttr  |= ( i & 0x3f ) << 10;
     940             :             }
     941           0 :             if ( ( pPortion->meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     942           0 :                 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Font, pPortion->mnFont ) ) )
     943           0 :                 nPropertyFlags |= 0x00010000;
     944           0 :             if ( ( pPortion->meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     945           0 :                 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_AsianOrComplexFont, pPortion->mnAsianOrComplexFont ) ) )
     946           0 :                 nPropertyFlags |= 0x00200000;
     947           0 :             if ( ( pPortion->meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     948           0 :                 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontHeight, pPortion->mnCharHeight ) ) )
     949           0 :                 nPropertyFlags |= 0x00020000;
     950           0 :             if ( ( pPortion->meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     951           0 :                 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontColor, nCharColor & 0xffffff ) ) )
     952           0 :                 nPropertyFlags |= 0x00040000;
     953           0 :             if ( ( pPortion->meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
     954           0 :                 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Escapement, pPortion->mnCharEscapement ) ) )
     955           0 :                 nPropertyFlags |= 0x00080000;
     956             : 
     957           0 :             sal_uInt32 nCharCount = pPortion->Count();
     958             : 
     959           0 :             rOut.WriteUInt32( nCharCount )
     960           0 :                 .WriteUInt32( nPropertyFlags );          //PropertyFlags
     961             : 
     962           0 :             if ( nPropertyFlags & 0xffff )
     963           0 :                 rOut.WriteUInt16( (sal_uInt16)( nCharAttr ) );
     964           0 :             if ( nPropertyFlags & 0x00010000 )
     965           0 :                 rOut.WriteUInt16( pPortion->mnFont );
     966           0 :             if ( nPropertyFlags & 0x00200000 )
     967           0 :                 rOut.WriteUInt16( pPortion->mnAsianOrComplexFont );
     968           0 :             if ( nPropertyFlags & 0x00020000 )
     969           0 :                 rOut.WriteUInt16( (sal_uInt16)( pPortion->mnCharHeight ) );
     970           0 :             if ( nPropertyFlags & 0x00040000 )
     971           0 :                 rOut.WriteUInt32( (sal_uInt32)nCharColor );
     972           0 :             if ( nPropertyFlags & 0x00080000 )
     973           0 :                 rOut.WriteInt16( pPortion->mnCharEscapement );
     974             :         }
     975             :     }
     976           0 : }
     977             : 
     978             : /**
     979             :  * Loads and converts text from shape, value is stored in mnTextSize.
     980             :  */
     981           0 : sal_Bool PPTWriter::ImplGetText()
     982             : {
     983           0 :     mnTextSize = 0;
     984           0 :     mbFontIndependentLineSpacing = sal_False;
     985           0 :     mXText = ::com::sun::star::uno::Reference<
     986             :         ::com::sun::star::text::XSimpleText >
     987           0 :             ( mXShape, ::com::sun::star::uno::UNO_QUERY );
     988             : 
     989           0 :     if ( mXText.is() )
     990             :     {
     991           0 :         mnTextSize = mXText->getString().getLength();
     992           0 :         ::com::sun::star::uno::Any aAny;
     993           0 :         if ( GetPropertyValue( aAny, mXPropSet, OUString( "FontIndependentLineSpacing" ) ), sal_True )
     994           0 :             aAny >>= mbFontIndependentLineSpacing;
     995             :     }
     996           0 :     return ( mnTextSize != 0 );
     997             : }
     998             : 
     999           0 : void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt )
    1000             : {
    1001           0 :     if ( mnAngle < 0 )
    1002           0 :         mnAngle = ( 36000 + mnAngle ) % 36000;
    1003             :     else
    1004           0 :         mnAngle = ( 36000 - ( mnAngle % 36000 ) );
    1005             : 
    1006           0 :     double  fCos = cos( (double)mnAngle * F_PI18000 );
    1007           0 :     double  fSin = sin( (double)mnAngle * F_PI18000 );
    1008             : 
    1009           0 :     double  fWidthHalf = maRect.GetWidth() / 2;
    1010           0 :     double  fHeightHalf = maRect.GetHeight() / 2;
    1011             : 
    1012           0 :     double  fXDiff = fCos * fWidthHalf + fSin * (-fHeightHalf);
    1013           0 :     double  fYDiff = - ( fSin * fWidthHalf - fCos * ( -fHeightHalf ) );
    1014             : 
    1015           0 :     maRect.Move( (sal_Int32)( -( fWidthHalf - fXDiff ) ), (sal_Int32)(  - ( fHeightHalf + fYDiff ) ) );
    1016           0 :     mnAngle *= 655;
    1017           0 :     mnAngle += 0x8000;
    1018           0 :     mnAngle &=~0xffff;                                  // round nAngle to full grads
    1019           0 :     rPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
    1020             : 
    1021           0 :     if ( ( mnAngle >= ( 45 << 16 ) && mnAngle < ( 135 << 16 ) ) ||
    1022           0 :             ( mnAngle >= ( 225 << 16 ) && mnAngle < ( 315 << 16 ) ) )
    1023             :     {
    1024             :         // Maddeningly, in those two areas of PPT is the BoundingBox already
    1025             :         // vertical. Therefore, we need to put down it BEFORE THE ROTATION.
    1026             :         ::com::sun::star::awt::Point
    1027           0 :             aTopLeft( (sal_Int32)( maRect.Left() + fWidthHalf - fHeightHalf ), (sal_Int32)( maRect.Top() + fHeightHalf - fWidthHalf ) );
    1028           0 :         Size    aNewSize( maRect.GetHeight(), maRect.GetWidth() );
    1029           0 :         maRect = Rectangle( Point( aTopLeft.X, aTopLeft.Y ), aNewSize );
    1030             :     }
    1031           0 : }
    1032             : 
    1033           0 : void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt )
    1034             : {
    1035           0 :     if ( !mbFontIndependentLineSpacing )
    1036             :     {
    1037           0 :         if ( rTextObj.ParagraphCount() )
    1038             :         {
    1039           0 :             ParagraphObj* pPara = rTextObj.GetParagraph(0);
    1040           0 :             if ( !pPara->empty() )
    1041             :             {
    1042           0 :                 PortionObj* pPortion = pPara->front();
    1043           0 :                 sal_Int16 nLineSpacing = pPara->mnLineSpacing;
    1044           0 :                 const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
    1045           0 :                 if ( pDesc )
    1046           0 :                      nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
    1047             : 
    1048           0 :                 if ( ( nLineSpacing > 0 ) && ( nLineSpacing < 100 ) )
    1049             :                 {
    1050           0 :                     double fCharHeight = pPortion->mnCharHeight;
    1051           0 :                     fCharHeight *= 2540 / 72;
    1052           0 :                     fCharHeight *= 100 - nLineSpacing;
    1053           0 :                     fCharHeight /= 100;
    1054             : 
    1055           0 :                     sal_uInt32 nUpperDistance = 0;
    1056           0 :                     rPropOpt.GetOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
    1057           0 :                     nUpperDistance += static_cast< sal_uInt32 >( fCharHeight * 360.0 );
    1058           0 :                     rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
    1059             :                 }
    1060             :             }
    1061             :         }
    1062             :     }
    1063           0 : }
    1064             : 
    1065           0 : void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
    1066             :     TextRuleEntry* pTextRule, SvStream& rExtBuStr, EscherPropertyContainer* pPropOpt )
    1067             : {
    1068           0 :     PPTExParaSheet& rParaSheet = mpStyleSheet->GetParaSheet( nTextInstance );
    1069             : 
    1070           0 :     rOut.WriteUInt32( (sal_uInt32)( ( EPP_TextHeaderAtom << 16 ) | ( nAtomInstance << 4 ) ) ).WriteUInt32( (sal_uInt32)4 )
    1071           0 :         .WriteInt32( sal_Int32(nTextInstance) );
    1072             : 
    1073           0 :     if ( mbEmptyPresObj )
    1074           0 :         mnTextSize = 0;
    1075           0 :     if ( !mbEmptyPresObj )
    1076             :     {
    1077             :         ParagraphObj* pPara;
    1078           0 :         TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this );
    1079             : 
    1080             :         // leaving out EPP_TextCharsAtom w/o text - still write out
    1081             :         // attribute info though
    1082           0 :         if ( mnTextSize )
    1083           0 :             aTextObj.Write( &rOut );
    1084             : 
    1085           0 :         if ( pPropOpt )
    1086           0 :             ImplAdjustFirstLineLineSpacing( aTextObj, *pPropOpt );
    1087             : 
    1088           0 :         sal_uInt32 nSize, nPos = rOut.Tell();
    1089             : 
    1090           0 :         rOut.WriteUInt32( (sal_uInt32)( EPP_StyleTextPropAtom << 16 ) ).WriteUInt32( (sal_uInt32)0 );
    1091           0 :         ImplWriteParagraphs( rOut, aTextObj );
    1092           0 :         ImplWritePortions( rOut, aTextObj );
    1093           0 :         nSize = rOut.Tell() - nPos;
    1094           0 :         rOut.SeekRel( - ( (sal_Int32)nSize - 4 ) );
    1095           0 :         rOut.WriteUInt32( (sal_uInt32)( nSize - 8 ) );
    1096           0 :         rOut.SeekRel( nSize - 8 );
    1097             : 
    1098           0 :         for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
    1099             :         {
    1100           0 :             pPara = aTextObj.GetParagraph(i);
    1101           0 :             for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
    1102             :             {
    1103           0 :                 PortionObj* pPortion = *it;
    1104           0 :                 if ( pPortion->mpFieldEntry )
    1105             :                 {
    1106           0 :                     const FieldEntry* pFieldEntry = pPortion->mpFieldEntry;
    1107             : 
    1108           0 :                     switch ( pFieldEntry->nFieldType >> 28 )
    1109             :                     {
    1110             :                         case 1 :
    1111             :                         case 2 :
    1112             :                         {
    1113           0 :                             rOut.WriteUInt32( (sal_uInt32)( EPP_DateTimeMCAtom << 16 ) ).WriteUInt32( (sal_uInt32)8 )
    1114           0 :                                 .WriteUInt32( (sal_uInt32)( pFieldEntry->nFieldStartPos ) )         // TxtOffset to TxtField;
    1115           0 :                                 .WriteUChar( (sal_uInt8)( pFieldEntry->nFieldType & 0xff ) )       // Type
    1116           0 :                                 .WriteUChar( (sal_uInt8)0 ).WriteUInt16( (sal_uInt16)0 );                      // PadBytes
    1117             :                         }
    1118           0 :                         break;
    1119             :                         case 3 :
    1120             :                         {
    1121           0 :                             rOut.WriteUInt32( (sal_uInt32)( EPP_SlideNumberMCAtom << 16 ) ).WriteUInt32( (sal_uInt32 ) 4 )
    1122           0 :                                 .WriteUInt32( (sal_uInt32)( pFieldEntry->nFieldStartPos ) );
    1123             :                         }
    1124           0 :                         break;
    1125             :                         case 4 :
    1126             :                         {
    1127           0 :                             sal_uInt32 nPageIndex = 0;
    1128           0 :                             OUString aPageUrl;
    1129           0 :                             OUString aFile( pFieldEntry->aFieldUrl );
    1130           0 :                             OUString aTarget( pFieldEntry->aFieldUrl );
    1131           0 :                             INetURLObject aUrl( pFieldEntry->aFieldUrl );
    1132           0 :                             if ( INET_PROT_FILE == aUrl.GetProtocol() )
    1133           0 :                                 aFile = aUrl.PathToFileName();
    1134           0 :                             else if ( INET_PROT_SMB == aUrl.GetProtocol() )
    1135             :                             {
    1136             :                                 // Convert smb notation to '\\' and skip the 'smb:' part
    1137           0 :                                 aFile = aUrl.GetMainURL(INetURLObject::NO_DECODE).copy(4);
    1138           0 :                                 aFile = aFile.replaceAll( "/", "\\" );
    1139           0 :                                 aTarget = aFile;
    1140             :                             }
    1141           0 :                             else if ( pFieldEntry->aFieldUrl[0] == '#' )
    1142             :                             {
    1143           0 :                                 OUString aPage( INetURLObject::decode( pFieldEntry->aFieldUrl, '%', INetURLObject::DECODE_WITH_CHARSET ) );
    1144           0 :                                 aPage = aPage.copy( 1 );
    1145             : 
    1146             :                                 std::vector<OUString>::const_iterator pIter = std::find(
    1147           0 :                                             maSlideNameList.begin(),maSlideNameList.end(),aPage);
    1148             : 
    1149           0 :                                 if ( pIter != maSlideNameList.end() )
    1150             :                                 {
    1151           0 :                                     nPageIndex = pIter - maSlideNameList.begin();
    1152           0 :                                     aPageUrl = OUString::number(256 + nPageIndex);
    1153           0 :                                     aPageUrl += ",";
    1154           0 :                                     aPageUrl += OUString::number(nPageIndex + 1);
    1155           0 :                                     aPageUrl += ",Slide ";
    1156           0 :                                     aPageUrl += OUString::number(nPageIndex + 1);
    1157           0 :                                 }
    1158             :                             }
    1159           0 :                             sal_uInt32 nHyperId(0);
    1160           0 :                             if ( !aPageUrl.isEmpty() )
    1161           0 :                                 nHyperId = ImplInsertBookmarkURL( aPageUrl, 1 | ( nPageIndex << 8 ) | ( 1U << 31 ), pFieldEntry->aRepresentation, "", "", aPageUrl );
    1162             :                             else
    1163           0 :                                 nHyperId = ImplInsertBookmarkURL( pFieldEntry->aFieldUrl, 2 | ( nHyperId << 8 ), aFile, aTarget, "", "" );
    1164             : 
    1165           0 :                             rOut.WriteUInt32( (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) ).WriteUInt32( (sal_uInt32)24 )
    1166           0 :                                 .WriteUInt32( (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) ).WriteUInt32( (sal_uInt32)16 )
    1167           0 :                                 .WriteUInt32( (sal_uInt32)0 )                                   // soundref
    1168           0 :                                 .WriteUInt32( nHyperId )                                        // hyperlink id
    1169           0 :                                 .WriteUChar( (sal_uInt8)4 )                                    // hyperlink action
    1170           0 :                                 .WriteUChar( (sal_uInt8)0 )                                    // ole verb
    1171           0 :                                 .WriteUChar( (sal_uInt8)0 )                                    // jump
    1172           0 :                                 .WriteUChar( (sal_uInt8)0 )                                    // flags
    1173           0 :                                 .WriteUChar( (sal_uInt8)8 )                                    // hyperlink type ?
    1174           0 :                                 .WriteUChar( (sal_uInt8)0 ).WriteUChar( (sal_uInt8)0 ).WriteUChar( (sal_uInt8)0 )
    1175           0 :                                 .WriteUInt32( (sal_uInt32)( EPP_TxInteractiveInfoAtom << 16 ) ).WriteUInt32( (sal_uInt32)8 )
    1176           0 :                                 .WriteUInt32( (sal_uInt32)( pFieldEntry->nFieldStartPos ) )
    1177           0 :                                 .WriteUInt32( (sal_uInt32)( pFieldEntry->nFieldEndPos ) );
    1178             :                         }
    1179           0 :                         break;
    1180             :                         case 5 :
    1181             :                         {
    1182           0 :                             rOut.WriteUInt32( (sal_uInt32)( EPP_GenericDateMCAtom << 16 ) ).WriteUInt32( (sal_uInt32)4 )
    1183           0 :                                 .WriteUInt32( (sal_uInt32)( pFieldEntry->nFieldStartPos ) );
    1184             :                         }
    1185           0 :                         break;
    1186             :                         case 6 :
    1187             :                         {
    1188           0 :                             rOut.WriteUInt32( (sal_uInt32)( EPP_HeaderMCAtom << 16 ) ).WriteUInt32( (sal_uInt32 ) 4 )
    1189           0 :                                 .WriteUInt32( (sal_uInt32)( pFieldEntry->nFieldStartPos ) );
    1190             :                         }
    1191           0 :                         break;
    1192             :                         case 7 :
    1193             :                         {
    1194           0 :                             rOut.WriteUInt32( (sal_uInt32)( EPP_FooterMCAtom << 16 ) ).WriteUInt32( (sal_uInt32 ) 4 )
    1195           0 :                                 .WriteUInt32( (sal_uInt32)( pFieldEntry->nFieldStartPos ) );
    1196             :                         }
    1197           0 :                         break;
    1198             :                         default:
    1199           0 :                         break;
    1200             :                     }
    1201             :                 }
    1202             :             }
    1203             :         }
    1204             : 
    1205           0 :         aTextObj.WriteTextSpecInfo( &rOut );
    1206             : 
    1207             :         // write Star Office Default TabSizes (if necessary)
    1208           0 :         if ( aTextObj.ParagraphCount() )
    1209             :         {
    1210           0 :             pPara = aTextObj.GetParagraph(0);
    1211           0 :             sal_uInt32  nParaFlags = 0x1f;
    1212             :             sal_Int16   nDepth, nMask, nNumberingRule[ 10 ];
    1213           0 :             sal_uInt32  nTextOfs = pPara->nTextOfs;
    1214           0 :             sal_uInt32  nTabs = pPara->maTabStop.getLength();
    1215           0 :             const ::com::sun::star::style::TabStop* pTabStop = ( const ::com::sun::star::style::TabStop* )pPara->maTabStop.getConstArray();
    1216             : 
    1217           0 :             for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
    1218             :             {
    1219           0 :                 pPara = aTextObj.GetParagraph(i);
    1220           0 :                 if ( pPara->bExtendedParameters )
    1221             :                 {
    1222           0 :                     nDepth = pPara->nDepth;
    1223           0 :                     if ( nDepth < 5 )
    1224             :                     {
    1225           0 :                         nMask = 1 << nDepth;
    1226           0 :                         if ( nParaFlags & nMask )
    1227             :                         {
    1228           0 :                             nParaFlags &=~ nMask;
    1229           0 :                             if ( ( rParaSheet.maParaLevel[ nDepth ].mnTextOfs != pPara->nTextOfs ) ||
    1230           0 :                                 ( rParaSheet.maParaLevel[ nDepth ].mnBulletOfs != pPara->nBulletOfs ) )
    1231             :                             {
    1232           0 :                                 nParaFlags |= nMask << 16;
    1233           0 :                                 nNumberingRule[ nDepth << 1 ] = pPara->nTextOfs;
    1234           0 :                                 nNumberingRule[ ( nDepth << 1 ) + 1 ] = (sal_Int16)pPara->nBulletOfs;
    1235             :                             }
    1236             :                         }
    1237             :                     }
    1238             :                 }
    1239             :             }
    1240           0 :             nParaFlags >>= 16;
    1241             : 
    1242           0 :             sal_Int32 nDefaultTabSizeSrc = 2011; // I've no idea where this number came from, honestly
    1243           0 :             const uno::Reference< beans::XPropertySet > xPropSet( mXModel, uno::UNO_QUERY );
    1244           0 :             if ( xPropSet.is() )
    1245             :             {
    1246           0 :                 ImplGetPropertyValue( xPropSet, OUString( "TabStop" ) );
    1247           0 :                 sal_Int32 nTabStop( 0 );
    1248           0 :                 if ( mAny >>= nTabStop )
    1249           0 :                     nDefaultTabSizeSrc = nTabStop;
    1250             :             }
    1251           0 :             const sal_uInt32 nDefaultTabSize = MapSize( awt::Size( nDefaultTabSizeSrc, 1 ) ).Width;
    1252           0 :             sal_uInt32  nDefaultTabs = std::abs( maRect.GetWidth() ) / nDefaultTabSize;
    1253           0 :             if ( nTabs )
    1254           0 :                 nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize );
    1255           0 :             if ( (sal_Int32)nDefaultTabs < 0 )
    1256           0 :                 nDefaultTabs = 0;
    1257             : 
    1258           0 :             sal_uInt32 nTabCount = nTabs + nDefaultTabs;
    1259           0 :             sal_uInt32 i, nTextRulerAtomFlags = 0;
    1260             : 
    1261           0 :             if ( nTabCount )
    1262           0 :                 nTextRulerAtomFlags |= 4;
    1263           0 :             if ( nParaFlags )
    1264           0 :                 nTextRulerAtomFlags |= ( ( nParaFlags << 3 ) | ( nParaFlags << 8 ) );
    1265             : 
    1266           0 :             if ( nTextRulerAtomFlags )
    1267             :             {
    1268           0 :                 SvStream* pRuleOut = &rOut;
    1269           0 :                 if ( pTextRule )
    1270           0 :                     pRuleOut = pTextRule->pOut = new SvMemoryStream( 0x100, 0x100 );
    1271             : 
    1272           0 :                 sal_uInt32 nRulePos = pRuleOut->Tell();
    1273           0 :                 pRuleOut->WriteUInt32( (sal_uInt32)( EPP_TextRulerAtom << 16 ) ).WriteUInt32( (sal_uInt32)0 );
    1274           0 :                 pRuleOut->WriteUInt32( nTextRulerAtomFlags );
    1275           0 :                 if ( nTextRulerAtomFlags & 4 )
    1276             :                 {
    1277           0 :                     pRuleOut->WriteUInt16( (sal_uInt16)nTabCount );
    1278           0 :                     for ( i = 0; i < nTabs; i++ )
    1279             :                     {
    1280           0 :                         sal_uInt16 nPosition = (sal_uInt16)( ( pTabStop[ i ].Position / 4.40972 ) + nTextOfs );
    1281             :                         sal_uInt16 nType;
    1282           0 :                         switch ( pTabStop[ i ].Alignment )
    1283             :                         {
    1284           0 :                             case ::com::sun::star::style::TabAlign_DECIMAL :    nType = 3; break;
    1285           0 :                             case ::com::sun::star::style::TabAlign_RIGHT :      nType = 2; break;
    1286           0 :                             case ::com::sun::star::style::TabAlign_CENTER :     nType = 1; break;
    1287             : 
    1288             :                             case ::com::sun::star::style::TabAlign_LEFT :
    1289           0 :                             default:                                            nType = 0;
    1290             :                         };
    1291           0 :                         pRuleOut->WriteUInt16( nPosition )
    1292           0 :                                  .WriteUInt16( nType );
    1293             :                     }
    1294             : 
    1295           0 :                     sal_uInt32 nWidth = 1;
    1296           0 :                     if ( nTabs )
    1297           0 :                         nWidth += (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 + nTextOfs ) / nDefaultTabSize ) );
    1298           0 :                     nWidth *= nDefaultTabSize;
    1299           0 :                     for ( i = 0; i < nDefaultTabs; i++, nWidth += nDefaultTabSize )
    1300           0 :                         pRuleOut->WriteUInt32( nWidth );
    1301             :                 }
    1302           0 :                 for ( i = 0; i < 5; i++ )
    1303             :                 {
    1304           0 :                     if ( nTextRulerAtomFlags & ( 8 << i ) )
    1305           0 :                         pRuleOut->WriteInt16( nNumberingRule[ i << 1 ] );
    1306           0 :                     if ( nTextRulerAtomFlags & ( 256 << i ) )
    1307           0 :                         pRuleOut->WriteInt16( nNumberingRule[ ( i << 1 ) + 1 ] );
    1308             :                 }
    1309           0 :                 sal_uInt32 nBufSize = pRuleOut->Tell() - nRulePos;
    1310           0 :                 pRuleOut->SeekRel( - ( (sal_Int32)nBufSize - 4 ) );
    1311           0 :                 pRuleOut->WriteUInt32( (sal_uInt32)( nBufSize - 8 ) );
    1312           0 :                 pRuleOut->SeekRel( nBufSize - 8 );
    1313           0 :             }
    1314             :         }
    1315           0 :         if ( aTextObj.HasExtendedBullets() )
    1316             :         {
    1317           0 :             if ( aTextObj.ParagraphCount() )
    1318             :             {
    1319           0 :                 sal_uInt32  nNumberingType = 0, nPos2 = rExtBuStr.Tell();
    1320             : 
    1321           0 :                 rExtBuStr.WriteUInt32( (sal_uInt32)( EPP_PST_ExtendedParagraphAtom << 16 ) ).WriteUInt32( (sal_uInt32)0 );
    1322             : 
    1323           0 :                 for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
    1324             :                 {
    1325           0 :                     ParagraphObj* pBulletPara = aTextObj.GetParagraph(i);
    1326           0 :                     sal_uInt32  nBulletFlags = 0;
    1327           0 :                     sal_uInt16 nBulletId = pBulletPara->nBulletId;
    1328             : 
    1329           0 :                     if ( pBulletPara->bExtendedBulletsUsed )
    1330             :                     {
    1331           0 :                         nBulletFlags = 0x800000;
    1332           0 :                         if ( pBulletPara->nNumberingType != SVX_NUM_BITMAP )
    1333           0 :                             nBulletFlags = 0x3000000;
    1334             :                     }
    1335           0 :                     rExtBuStr.WriteUInt32( (sal_uInt32)nBulletFlags );
    1336             : 
    1337           0 :                     if ( nBulletFlags & 0x800000 )
    1338           0 :                         rExtBuStr.WriteUInt16( nBulletId );
    1339           0 :                     if ( nBulletFlags & 0x1000000 )
    1340             :                     {
    1341           0 :                         switch( pBulletPara->nNumberingType )
    1342             :                         {
    1343             :                             case SVX_NUM_NUMBER_NONE :
    1344             :                             case SVX_NUM_CHAR_SPECIAL :
    1345           0 :                                 nNumberingType = 0;
    1346           0 :                             break;
    1347             :                             case SVX_NUM_CHARS_UPPER_LETTER :
    1348             :                             case SVX_NUM_CHARS_UPPER_LETTER_N :
    1349             :                             case SVX_NUM_CHARS_LOWER_LETTER :
    1350             :                             case SVX_NUM_CHARS_LOWER_LETTER_N :
    1351             :                             case SVX_NUM_ROMAN_UPPER :
    1352             :                             case SVX_NUM_ROMAN_LOWER :
    1353             :                             case SVX_NUM_ARABIC :
    1354             :                             case SVX_NUM_NUMBER_UPPER_ZH:
    1355             :                             case SVX_NUM_CIRCLE_NUMBER:
    1356             :                             case SVX_NUM_NUMBER_UPPER_ZH_TW:
    1357             :                             case SVX_NUM_NUMBER_LOWER_ZH:
    1358             :                             case SVX_NUM_FULL_WIDTH_ARABIC:
    1359           0 :                                 nNumberingType = pBulletPara->nMappedNumType;
    1360           0 :                             break;
    1361             : 
    1362             :                             case SVX_NUM_BITMAP :
    1363           0 :                                 nNumberingType = 0;
    1364           0 :                             break;
    1365             : 
    1366             :                         }
    1367           0 :                         rExtBuStr.WriteUInt32( (sal_uInt32)nNumberingType );
    1368             :                     }
    1369           0 :                     if ( nBulletFlags & 0x2000000 )
    1370           0 :                         rExtBuStr.WriteUInt16( (sal_uInt16)pBulletPara->nStartWith );
    1371           0 :                     rExtBuStr.WriteUInt32( (sal_uInt32)0 ).WriteUInt32( (sal_uInt32)0 );
    1372             :                 }
    1373           0 :                 sal_uInt32 nBulletSize = ( rExtBuStr.Tell() - nPos2 ) - 8;
    1374           0 :                 rExtBuStr.SeekRel( - ( (sal_Int32)nBulletSize + 4 ) );
    1375           0 :                 rExtBuStr.WriteUInt32( nBulletSize );
    1376           0 :                 rExtBuStr.SeekRel( nBulletSize );
    1377             :             }
    1378           0 :         }
    1379             :     }
    1380           0 : }
    1381             : 
    1382           0 : void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
    1383             :     ::com::sun::star::presentation::AnimationEffect eAe,
    1384             :     ::com::sun::star::presentation::AnimationEffect eTe,
    1385             :     sal_uInt16 nOrder )
    1386             : {
    1387           0 :     EscherExContainer aAnimationInfo( rSt, EPP_AnimationInfo );
    1388           0 :     EscherExAtom aAnimationInfoAtom( rSt, EPP_AnimationInfoAtom, 0, 1 );
    1389           0 :     sal_uInt32  nDimColor = 0x7000000;  // color to use for dimming
    1390           0 :     sal_uInt32  nFlags = 0x4400;        // set of flags that determine type of build
    1391           0 :     sal_uInt32  nSoundRef = 0;          // 0 if storage is from clipboard. Otherwise index(ID) in SoundCollection list.
    1392           0 :     sal_uInt32  nDelayTime = 0;         // delay before playing object
    1393           0 :     sal_uInt16  nSlideCount = 1;        // number of slides to play object
    1394           0 :     sal_uInt8   nBuildType = 1;         // type of build
    1395           0 :     sal_uInt8   nFlyMethod = 0;         // animation effect( fly, zoom, appear, etc )
    1396           0 :     sal_uInt8   nFlyDirection = 0;      // Animation direction( left, right, up, down, etc )
    1397           0 :     sal_uInt8   nAfterEffect = 0;       // what to do after build
    1398           0 :     sal_uInt8   nSubEffect = 0;         // build by word or letter
    1399           0 :     sal_uInt8   nOleVerb = 0;           // Determines object's class (sound, video, other)
    1400             : 
    1401           0 :     if ( eAe == ::com::sun::star::presentation::AnimationEffect_NONE )
    1402             :     {
    1403           0 :         nBuildType = 0;
    1404           0 :         eAe = eTe;
    1405             :     }
    1406           0 :     switch ( eAe )
    1407             :     {
    1408             :         case ::com::sun::star::presentation::AnimationEffect_NONE :
    1409           0 :         break;
    1410             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LEFT :
    1411             :         {
    1412           0 :             nFlyDirection = 2;
    1413           0 :             nFlyMethod = 10;
    1414             :         }
    1415           0 :         break;
    1416             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_TOP :
    1417             :         {
    1418           0 :             nFlyDirection = 3;
    1419           0 :             nFlyMethod = 10;
    1420             :         }
    1421           0 :         break;
    1422             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_RIGHT :
    1423             :         {
    1424           0 :             nFlyDirection = 0;
    1425           0 :             nFlyMethod = 10;
    1426             :         }
    1427           0 :         break;
    1428             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_BOTTOM :
    1429             :         {
    1430           0 :             nFlyDirection = 1;
    1431           0 :             nFlyMethod = 10;
    1432             :         }
    1433           0 :         break;
    1434             :         case ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER :
    1435             :         {
    1436           0 :             nFlyDirection = 1;
    1437           0 :             nFlyMethod = 11;
    1438             :         }
    1439           0 :         break;
    1440             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER :
    1441             :         {
    1442           0 :             nFlyDirection = 0;
    1443           0 :             nFlyMethod = 11;
    1444             :         }
    1445           0 :         break;
    1446             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LEFT :
    1447             :         {
    1448           0 :             nFlyDirection = 0;
    1449           0 :             nFlyMethod = 12;
    1450             :         }
    1451           0 :         break;
    1452             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_TOP :
    1453             :         {
    1454           0 :             nFlyDirection = 1;
    1455           0 :             nFlyMethod = 12;
    1456             :         }
    1457           0 :         break;
    1458             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_RIGHT :
    1459             :         {
    1460           0 :             nFlyDirection = 2;
    1461           0 :             nFlyMethod = 12;
    1462             :         }
    1463           0 :         break;
    1464             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_BOTTOM :
    1465             :         {
    1466           0 :             nFlyDirection = 3;
    1467           0 :             nFlyMethod = 12;
    1468             :         }
    1469           0 :         break;
    1470             :         case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRIPES :
    1471             :         {
    1472           0 :             nFlyDirection = 0;
    1473           0 :             nFlyMethod = 2;
    1474             :         }
    1475           0 :         break;
    1476             :         case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRIPES :
    1477             :         {
    1478           0 :             nFlyDirection = 1;
    1479           0 :             nFlyMethod = 2;
    1480             :         }
    1481           0 :         break;
    1482             :         case ::com::sun::star::presentation::AnimationEffect_CLOCKWISE :
    1483             :         {
    1484           0 :             nFlyDirection = 1;
    1485           0 :             nFlyMethod = 3;
    1486             :         }
    1487           0 :         break;
    1488             :         case ::com::sun::star::presentation::AnimationEffect_COUNTERCLOCKWISE :
    1489             :         {
    1490           0 :             nFlyDirection = 0;
    1491           0 :             nFlyMethod = 3;
    1492             :         }
    1493           0 :         break;
    1494             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERLEFT :
    1495             :         {
    1496           0 :             nFlyDirection = 7;
    1497           0 :             nFlyMethod = 9;
    1498             :         }
    1499           0 :         break;
    1500             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERRIGHT :
    1501             :         {
    1502           0 :             nFlyDirection = 6;
    1503           0 :             nFlyMethod = 9;
    1504             :         }
    1505           0 :         break;
    1506             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERLEFT :
    1507             :         {
    1508           0 :             nFlyDirection = 5;
    1509           0 :             nFlyMethod = 9;
    1510             :         }
    1511           0 :         break;
    1512             :         case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERRIGHT :
    1513             :         {
    1514           0 :             nFlyDirection = 4;
    1515           0 :             nFlyMethod = 9;
    1516             :         }
    1517           0 :         break;
    1518             :         case ::com::sun::star::presentation::AnimationEffect_CLOSE_VERTICAL :
    1519             :         {
    1520           0 :             nFlyDirection = 1;
    1521           0 :             nFlyMethod = 13;
    1522             :         }
    1523           0 :         break;
    1524             :         case ::com::sun::star::presentation::AnimationEffect_CLOSE_HORIZONTAL :
    1525             :         {
    1526           0 :             nFlyDirection = 3;
    1527           0 :             nFlyMethod = 13;
    1528             :         }
    1529           0 :         break;
    1530             :         case ::com::sun::star::presentation::AnimationEffect_OPEN_VERTICAL :
    1531             :         {
    1532           0 :             nFlyDirection = 0;
    1533           0 :             nFlyMethod = 13;
    1534             :         }
    1535           0 :         break;
    1536             :         case ::com::sun::star::presentation::AnimationEffect_OPEN_HORIZONTAL :
    1537             :         {
    1538           0 :             nFlyDirection = 2;
    1539           0 :             nFlyMethod = 13;
    1540             :         }
    1541           0 :         break;
    1542             :         case ::com::sun::star::presentation::AnimationEffect_PATH :
    1543             :         {
    1544           0 :             nFlyDirection = 28;
    1545           0 :             nFlyMethod = 12;
    1546             :         }
    1547           0 :         break;
    1548             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LEFT :
    1549             :         {
    1550           0 :             nFlyDirection = 0;
    1551           0 :             nFlyMethod = 1;
    1552             :         }
    1553           0 :         break;
    1554             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_TOP :
    1555             :         {
    1556           0 :             nFlyDirection = 0;
    1557           0 :             nFlyMethod = 1;
    1558             :         }
    1559           0 :         break;
    1560             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_RIGHT :
    1561             :         {
    1562           0 :             nFlyDirection = 0;
    1563           0 :             nFlyMethod = 1;
    1564             :         }
    1565           0 :         break;
    1566             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_BOTTOM :
    1567             :         {
    1568           0 :             nFlyDirection = 0;
    1569           0 :             nFlyMethod = 1;
    1570             :         }
    1571           0 :         break;
    1572             :         case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_LEFT :
    1573             :         case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_RIGHT :
    1574             :         case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_LEFT :
    1575             :         case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_RIGHT :
    1576             :         {
    1577           0 :             nFlyDirection = 0x1c;
    1578           0 :             nFlyMethod = 0xc;
    1579             :         }
    1580           0 :         break;
    1581             :         case ::com::sun::star::presentation::AnimationEffect_DISSOLVE :
    1582             :         {
    1583           0 :             nFlyDirection = 0;
    1584           0 :             nFlyMethod = 5;
    1585             :         }
    1586           0 :         break;
    1587             :         case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_LEFT :
    1588             :         {
    1589           0 :             nFlyDirection = 2;
    1590           0 :             nFlyMethod = 10;
    1591             :         }
    1592           0 :         break;
    1593             :         case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_TOP :
    1594             :         {
    1595           0 :             nFlyDirection = 3;
    1596           0 :             nFlyMethod = 10;
    1597             :         }
    1598           0 :         break;
    1599             :         case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_RIGHT :
    1600             :         {
    1601           0 :             nFlyDirection = 0;
    1602           0 :             nFlyMethod = 10;
    1603             :         }
    1604           0 :         break;
    1605             :         case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_BOTTOM :
    1606             :         {
    1607           0 :             nFlyDirection = 1;
    1608           0 :             nFlyMethod = 10;
    1609             :         }
    1610           0 :         break;
    1611             :         case ::com::sun::star::presentation::AnimationEffect_RANDOM :
    1612             :         {
    1613           0 :             nFlyDirection = 0;
    1614           0 :             nFlyMethod = 1;
    1615             :         }
    1616           0 :         break;
    1617             :         case ::com::sun::star::presentation::AnimationEffect_VERTICAL_LINES :
    1618             :         {
    1619           0 :             nFlyDirection = 1;
    1620           0 :             nFlyMethod = 8;
    1621             :         }
    1622           0 :         break;
    1623             :         case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_LINES :
    1624             :         {
    1625           0 :             nFlyDirection = 0;
    1626           0 :             nFlyMethod = 8;
    1627             :         }
    1628           0 :         break;
    1629             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LEFT :
    1630             :         {
    1631           0 :             nFlyDirection = 2;
    1632           0 :             nFlyMethod = 10;
    1633             :         }
    1634           0 :         break;
    1635             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_TOP :
    1636             :         {
    1637           0 :             nFlyDirection = 3;
    1638           0 :             nFlyMethod = 10;
    1639             :         }
    1640           0 :         break;
    1641             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_RIGHT :
    1642             :         {
    1643           0 :             nFlyDirection = 0;
    1644           0 :             nFlyMethod = 10;
    1645             :         }
    1646           0 :         break;
    1647             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_BOTTOM :
    1648             :         {
    1649           0 :             nFlyDirection = 1;
    1650           0 :             nFlyMethod = 10;
    1651             :         }
    1652           0 :         break;
    1653             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERLEFT :
    1654             :         {
    1655           0 :             nFlyDirection = 7;
    1656           0 :             nFlyMethod = 9;
    1657             :         }
    1658           0 :         break;
    1659             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERRIGHT :
    1660             :         {
    1661           0 :             nFlyDirection = 6;
    1662           0 :             nFlyMethod = 9;
    1663             :         }
    1664           0 :         break;
    1665             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERLEFT :
    1666             :         {
    1667           0 :             nFlyDirection = 5;
    1668           0 :             nFlyMethod = 9;
    1669             :         }
    1670           0 :         break;
    1671             :         case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERRIGHT :
    1672             :         {
    1673           0 :             nFlyDirection = 4;
    1674           0 :             nFlyMethod = 9;
    1675             :         }
    1676           0 :         break;
    1677             :         case ::com::sun::star::presentation::AnimationEffect_APPEAR :
    1678           0 :         break;
    1679             :         case ::com::sun::star::presentation::AnimationEffect_HIDE :
    1680             :         {
    1681           0 :             nFlyDirection = 0;
    1682           0 :             nFlyMethod = 1;
    1683             :         }
    1684           0 :         break;
    1685             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERLEFT :
    1686             :         {
    1687           0 :             nFlyDirection = 4;
    1688           0 :             nFlyMethod = 12;
    1689             :         }
    1690           0 :         break;
    1691             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERRIGHT :
    1692             :         {
    1693           0 :             nFlyDirection = 5;
    1694           0 :             nFlyMethod = 12;
    1695             :         }
    1696           0 :         break;
    1697             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERRIGHT :
    1698             :         {
    1699           0 :             nFlyDirection = 7;
    1700           0 :             nFlyMethod = 12;
    1701             :         }
    1702           0 :         break;
    1703             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERLEFT :
    1704             :         {
    1705           0 :             nFlyDirection = 6;
    1706           0 :             nFlyMethod = 12;
    1707             :         }
    1708           0 :         break;
    1709             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERLEFT :
    1710             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERRIGHT :
    1711             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERRIGHT :
    1712             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERLEFT :
    1713           0 :             nAfterEffect |= 2;
    1714           0 :         break;
    1715             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LEFT :
    1716             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT :
    1717             :         {
    1718           0 :             nFlyDirection = 8;
    1719           0 :             nFlyMethod = 12;
    1720             :         }
    1721           0 :         break;
    1722             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_TOP :
    1723             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT :
    1724             :         {
    1725           0 :             nFlyDirection = 11;
    1726           0 :             nFlyMethod = 12;
    1727             :         }
    1728           0 :         break;
    1729             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_RIGHT :
    1730             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT :
    1731             :         {
    1732           0 :             nFlyDirection = 10;
    1733           0 :             nFlyMethod = 12;
    1734             :         }
    1735           0 :         break;
    1736             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_BOTTOM :
    1737             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT :
    1738             :         {
    1739           0 :             nFlyDirection = 9;
    1740           0 :             nFlyMethod = 12;
    1741             :         }
    1742           0 :         break;
    1743             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LEFT :
    1744             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERLEFT :
    1745             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_TOP :
    1746             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT :
    1747             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_RIGHT :
    1748             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT :
    1749             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_BOTTOM :
    1750             :         case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERLEFT :
    1751           0 :             nAfterEffect |= 2;
    1752           0 :         break;
    1753             :         case ::com::sun::star::presentation::AnimationEffect_VERTICAL_CHECKERBOARD :
    1754             :         {
    1755           0 :             nFlyDirection = 1;
    1756           0 :             nFlyMethod = 3;
    1757             :         }
    1758           0 :         break;
    1759             :         case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_CHECKERBOARD :
    1760             :         {
    1761           0 :             nFlyDirection = 0;
    1762           0 :             nFlyMethod = 3;
    1763             :         }
    1764           0 :         break;
    1765             :         case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_ROTATE :
    1766             :         case ::com::sun::star::presentation::AnimationEffect_VERTICAL_ROTATE :
    1767             :         {
    1768           0 :             nFlyDirection = 27;
    1769           0 :             nFlyMethod = 12;
    1770             :         }
    1771           0 :         break;
    1772             :         case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRETCH :
    1773             :         case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRETCH :
    1774             :         {
    1775           0 :             nFlyDirection = 22;
    1776           0 :             nFlyMethod = 12;
    1777             :         }
    1778           0 :         break;
    1779             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LEFT :
    1780             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERLEFT :
    1781             :         {
    1782           0 :             nFlyDirection = 23;
    1783           0 :             nFlyMethod = 12;
    1784             :         }
    1785           0 :         break;
    1786             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_TOP :
    1787             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERRIGHT :
    1788             :         {
    1789           0 :             nFlyDirection = 24;
    1790           0 :             nFlyMethod = 12;
    1791             :         }
    1792           0 :         break;
    1793             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_RIGHT :
    1794             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERRIGHT :
    1795             :         {
    1796           0 :             nFlyDirection = 25;
    1797           0 :             nFlyMethod = 12;
    1798             :         }
    1799           0 :         break;
    1800             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_BOTTOM :
    1801             :         case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERLEFT :
    1802             :         {
    1803           0 :             nFlyDirection = 26;
    1804           0 :             nFlyMethod = 12;
    1805             :         }
    1806           0 :         break;
    1807             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN :
    1808             :         {
    1809           0 :             nFlyDirection = 16;
    1810           0 :             nFlyMethod = 12;
    1811             :         }
    1812           0 :         break;
    1813             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SMALL :
    1814             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SPIRAL :
    1815             :         {
    1816           0 :             nFlyDirection = 17;
    1817           0 :             nFlyMethod = 12;
    1818             :         }
    1819           0 :         break;
    1820             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT :
    1821             :         {
    1822           0 :             nFlyDirection = 18;
    1823           0 :             nFlyMethod = 12;
    1824             :         }
    1825           0 :         break;
    1826             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SMALL :
    1827             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SPIRAL :
    1828             :         {
    1829           0 :             nFlyDirection = 19;
    1830           0 :             nFlyMethod = 12;
    1831             :         }
    1832           0 :         break;
    1833             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LEFT :
    1834             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERLEFT :
    1835             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_TOP :
    1836             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT :
    1837             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_RIGHT :
    1838             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT :
    1839             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_BOTTOM :
    1840             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERLEFT :
    1841             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_CENTER :
    1842             :         {
    1843           0 :             nFlyDirection = 16;
    1844           0 :             nFlyMethod = 12;
    1845             :         }
    1846           0 :         break;
    1847             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LEFT :
    1848             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT :
    1849             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_TOP :
    1850             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT :
    1851             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_RIGHT :
    1852             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT :
    1853             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_BOTTOM :
    1854             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT :
    1855             :         case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_CENTER :
    1856           0 :             nAfterEffect |= 2;
    1857           0 :             break;
    1858             :         default:
    1859           0 :             break;
    1860             :     }
    1861           0 :     if ( mnDiaMode >= 1 )
    1862           0 :         nFlags |= 4;
    1863           0 :     if ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
    1864           0 :         nBuildType = 2;
    1865           0 :     if ( ImplGetPropertyValue( OUString( "SoundOn" ) ) )
    1866             :     {
    1867           0 :         sal_Bool bBool(sal_False);
    1868           0 :         mAny >>= bBool;
    1869           0 :         if ( bBool )
    1870             :         {
    1871           0 :             if ( ImplGetPropertyValue( OUString( "Sound" ) ) )
    1872             :             {
    1873           0 :                 nSoundRef = maSoundCollection.GetId( *(OUString*)mAny.getValue() );
    1874           0 :                 if ( nSoundRef )
    1875           0 :                     nFlags |= 0x10;
    1876             :             }
    1877             :         }
    1878             :     }
    1879           0 :     sal_Bool bDimHide = sal_False;
    1880           0 :     sal_Bool bDimPrevious = sal_False;
    1881           0 :     if ( ImplGetPropertyValue( OUString( "DimHide" ) ) )
    1882           0 :         mAny >>= bDimHide;
    1883           0 :     if ( ImplGetPropertyValue( OUString( "DimPrevious" ) ) )
    1884           0 :         mAny >>= bDimPrevious;
    1885           0 :     if ( bDimPrevious )
    1886           0 :         nAfterEffect |= 1;
    1887           0 :     if ( bDimHide )
    1888           0 :         nAfterEffect |= 2;
    1889           0 :     if ( ImplGetPropertyValue( OUString( "DimColor" ) ) )
    1890           0 :         nDimColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ) | 0xfe000000;
    1891             : 
    1892           0 :     rSt.WriteUInt32( nDimColor ).WriteUInt32( nFlags ).WriteUInt32( nSoundRef ).WriteUInt32( nDelayTime )
    1893           0 :        .WriteUInt16( nOrder )                                   // order of build ( 1.. )
    1894           0 :        .WriteUInt16( nSlideCount ).WriteUChar( nBuildType ).WriteUChar( nFlyMethod ).WriteUChar( nFlyDirection )
    1895           0 :        .WriteUChar( nAfterEffect ).WriteUChar( nSubEffect ).WriteUChar( nOleVerb )
    1896           0 :        .WriteUInt16( (sal_uInt16)0 );                               // PadWord
    1897           0 : }
    1898             : 
    1899           0 : void PPTWriter::ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eCa, sal_Bool bMediaClickAction )
    1900             : {
    1901           0 :     sal_uInt32 nSoundRef = 0;   // a reference to a sound in the sound collection, or NULL.
    1902           0 :     sal_uInt32 nHyperLinkID = 0;// a persistent unique identifier to an external hyperlink object (only valid when action == HyperlinkAction).
    1903           0 :     sal_uInt8   nAction = 0;     // Action See Action Table
    1904           0 :     sal_uInt8   nOleVerb = 0;    // OleVerb Only valid when action == OLEAction. OLE verb to use, 0 = first verb, 1 = second verb, etc.
    1905           0 :     sal_uInt8   nJump = 0;       // Jump See Jump Table
    1906           0 :     sal_uInt8   nFlags = 0;      // Bit 1: Animated. If 1, then button is animated
    1907             :                             // Bit 2: Stop sound. If 1, then stop current sound when button is pressed.
    1908             :                             // Bit 3: CustomShowReturn. If 1, and this is a jump to custom show, then return to this slide after custom show.
    1909           0 :     sal_uInt8   nHyperLinkType = 0;// HyperlinkType a value from the LinkTo enum, such as LT_URL (only valid when action == HyperlinkAction).
    1910             : 
    1911           0 :     OUString aFile;
    1912             : 
    1913             :     /*
    1914             :         Action Table:       Action Value
    1915             :         NoAction            0
    1916             :         MacroAction         1
    1917             :         RunProgramAction    2
    1918             :         JumpAction          3
    1919             :         HyperlinkAction     4
    1920             :         OLEAction           5
    1921             :         MediaAction         6
    1922             :         CustomShowAction    7
    1923             : 
    1924             :         Jump Table:     Jump Value
    1925             :         NoJump          0
    1926             :         NextSlide,      1
    1927             :         PreviousSlide,  2
    1928             :         FirstSlide,     3
    1929             :         LastSlide,      4
    1930             :         LastSlideViewed 5
    1931             :         EndShow         6
    1932             :     */
    1933             : 
    1934           0 :     if ( bMediaClickAction )
    1935           0 :         nAction = 6;
    1936           0 :     else switch( eCa )
    1937             :     {
    1938             :         case ::com::sun::star::presentation::ClickAction_STOPPRESENTATION :
    1939           0 :             nJump += 2;
    1940             :         case ::com::sun::star::presentation::ClickAction_LASTPAGE :
    1941           0 :             nJump++;
    1942             :         case ::com::sun::star::presentation::ClickAction_FIRSTPAGE :
    1943           0 :             nJump++;
    1944             :         case ::com::sun::star::presentation::ClickAction_PREVPAGE :
    1945           0 :             nJump++;
    1946             :         case ::com::sun::star::presentation::ClickAction_NEXTPAGE :
    1947             :         {
    1948           0 :             nJump++;
    1949           0 :             nAction = 3;
    1950             :         }
    1951           0 :         break;
    1952             :         case ::com::sun::star::presentation::ClickAction_SOUND :
    1953             :         {
    1954           0 :             if ( ImplGetPropertyValue( OUString( "Bookmark" ) ) )
    1955           0 :                 nSoundRef = maSoundCollection.GetId( *(OUString*)mAny.getValue() );
    1956             :         }
    1957           0 :         break;
    1958             :         case ::com::sun::star::presentation::ClickAction_PROGRAM :
    1959             :         {
    1960           0 :             if ( ImplGetPropertyValue( OUString( "Bookmark" ) ) )
    1961             :             {
    1962           0 :                 INetURLObject aUrl( *(OUString*)mAny.getValue() );
    1963           0 :                 if ( INET_PROT_FILE == aUrl.GetProtocol() )
    1964             :                 {
    1965           0 :                     aFile = aUrl.PathToFileName();
    1966           0 :                     nAction = 2;
    1967           0 :                 }
    1968             :             }
    1969             :         }
    1970           0 :         break;
    1971             : 
    1972             :         case ::com::sun::star::presentation::ClickAction_BOOKMARK :
    1973             :         {
    1974           0 :             if ( ImplGetPropertyValue( OUString( "Bookmark" ) ) )
    1975             :             {
    1976           0 :                 OUString  aBookmark( *(OUString*)mAny.getValue() );
    1977           0 :                 sal_uInt32 nIndex = 0;
    1978           0 :                 std::vector<OUString>::const_iterator pIter;
    1979           0 :                 for ( pIter = maSlideNameList.begin(); pIter != maSlideNameList.end(); ++pIter, nIndex++ )
    1980             :                 {
    1981           0 :                     if ( *pIter == aBookmark )
    1982             :                     {
    1983             :                         // Bookmark is a link to a document page
    1984           0 :                         nAction = 4;
    1985           0 :                         nHyperLinkType = 7;
    1986             : 
    1987           0 :                         OUString aHyperString = OUString::number(256 + nIndex);
    1988           0 :                         aHyperString += ",";
    1989           0 :                         aHyperString += OUString::number(nIndex + 1);
    1990           0 :                         aHyperString += ",Slide ";
    1991           0 :                         aHyperString += OUString::number(nIndex + 1);
    1992           0 :                         nHyperLinkID = ImplInsertBookmarkURL( aHyperString, 1 | ( nIndex << 8 ) | ( 1U << 31 ), aBookmark, "", "", aHyperString );
    1993             :                     }
    1994           0 :                 }
    1995             :             }
    1996             :         }
    1997           0 :         break;
    1998             : 
    1999             :         case ::com::sun::star::presentation::ClickAction_DOCUMENT :
    2000             :         {
    2001           0 :             if ( ImplGetPropertyValue( OUString( "Bookmark" ) ) )
    2002             :             {
    2003           0 :                 OUString aBookmark( *(OUString*)mAny.getValue() );
    2004           0 :                 if ( !aBookmark.isEmpty() )
    2005             :                 {
    2006           0 :                     nAction = 4;
    2007           0 :                     nHyperLinkType = 8;
    2008             : 
    2009           0 :                     OUString aBookmarkFile( aBookmark );
    2010           0 :                     INetURLObject aUrl( aBookmark );
    2011           0 :                     if ( INET_PROT_FILE == aUrl.GetProtocol() )
    2012           0 :                         aBookmarkFile = aUrl.PathToFileName();
    2013           0 :                     nHyperLinkID = ImplInsertBookmarkURL( aBookmark, (sal_uInt32)(2 | ( 1U << 31 )), aBookmarkFile, aBookmark, "", "" );
    2014           0 :                 }
    2015             :             }
    2016             :         }
    2017           0 :         break;
    2018             : 
    2019             :         case ::com::sun::star::presentation::ClickAction_INVISIBLE :
    2020             :         case ::com::sun::star::presentation::ClickAction_VERB :
    2021             :         case ::com::sun::star::presentation::ClickAction_VANISH :
    2022             :         case ::com::sun::star::presentation::ClickAction_MACRO :
    2023             :         default :
    2024           0 :         break;
    2025             :     }
    2026             : 
    2027           0 :     sal_uInt32 nContainerSize = 24;
    2028           0 :     if ( nAction == 2 )
    2029           0 :         nContainerSize += ( aFile.getLength() * 2 ) + 8;
    2030           0 :     rSt.WriteUInt32( (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) ).WriteUInt32( (sal_uInt32)nContainerSize )
    2031           0 :        .WriteUInt32( (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) ).WriteUInt32( (sal_uInt32)16 )
    2032           0 :        .WriteUInt32( nSoundRef )
    2033           0 :        .WriteUInt32( nHyperLinkID )
    2034           0 :        .WriteUChar( nAction )
    2035           0 :        .WriteUChar( nOleVerb )
    2036           0 :        .WriteUChar( nJump )
    2037           0 :        .WriteUChar( nFlags )
    2038           0 :        .WriteUInt32( (sal_uInt32)nHyperLinkType );
    2039             : 
    2040           0 :     if ( nAction == 2 )     // run program Action
    2041             :     {
    2042           0 :         sal_Int32 nLen = aFile.getLength();
    2043           0 :         rSt.WriteUInt32( (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) ).WriteUInt32( (sal_uInt32)( nLen * 2 ) );
    2044           0 :         for ( sal_Int32 i = 0; i < nLen; i++ )
    2045           0 :             rSt.WriteUInt16( aFile[i] );
    2046             :     }
    2047             : 
    2048           0 :     rSt.WriteUInt32( (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0x1f ) ).WriteUInt32( (sal_uInt32)24 )   // Mouse Over Action
    2049           0 :        .WriteUInt32( (sal_uInt32)( EPP_InteractiveInfo << 16 ) ).WriteUInt32( (sal_uInt32)16 );
    2050           0 :     for ( int i = 0; i < 4; i++, rSt.WriteUInt32( (sal_uInt32)0 ) ) ;
    2051           0 : }
    2052             : 
    2053           0 : sal_Bool PPTWriter::ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPropSet,
    2054             :                                 ::com::sun::star::presentation::AnimationEffect& eEffect,
    2055             :                                 ::com::sun::star::presentation::AnimationEffect& eTextEffect,
    2056             :                                 sal_Bool& bIsSound )
    2057             : {
    2058           0 :     ::com::sun::star::uno::Any aAny;
    2059           0 :     if ( GetPropertyValue( aAny, rPropSet, OUString( "Effect" ) ) )
    2060           0 :         aAny >>= eEffect;
    2061             :     else
    2062           0 :         eEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
    2063             : 
    2064           0 :     if ( GetPropertyValue( aAny, rPropSet, OUString( "TextEffect" ) ) )
    2065           0 :         aAny >>= eTextEffect;
    2066             :     else
    2067           0 :         eTextEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
    2068           0 :     if ( GetPropertyValue( aAny, rPropSet, OUString( "SoundOn" ) ) )
    2069           0 :         aAny >>= bIsSound;
    2070             :     else
    2071           0 :         bIsSound = sal_False;
    2072             : 
    2073           0 :     sal_Bool bHasEffect = ( ( eEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
    2074           0 :                         || ( eTextEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
    2075           0 :                         || bIsSound );
    2076           0 :     return bHasEffect;
    2077             : };
    2078             : 
    2079           0 : sal_Bool PPTWriter::ImplCreatePresentationPlaceholder( const sal_Bool bMasterPage, const PageType /* ePageType */,
    2080             :                                                         const sal_uInt32 nStyleInstance, const sal_uInt8 nPlaceHolderId )
    2081             : {
    2082           0 :     sal_Bool bRet = ImplGetText();
    2083           0 :     if ( bRet && bMasterPage )
    2084             :     {
    2085           0 :         mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2086           0 :         sal_uInt32 nPresShapeID = mpPptEscherEx->GenerateShapeId();
    2087           0 :         mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nPresShapeID );// Flags: HaveAnchor | HasSpt
    2088           0 :         EscherPropertyContainer aPropOpt;
    2089           0 :         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
    2090           0 :         aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
    2091           0 :         aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
    2092           0 :         aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
    2093           0 :         aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
    2094           0 :         aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
    2095           0 :         aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2096           0 :         sal_uInt32 nLineFlags = 0x90001;
    2097           0 :         if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
    2098           0 :             nLineFlags |= 0x10001;  // draw dashed line if no line
    2099           0 :         aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
    2100             : 
    2101           0 :         SvMemoryStream  aExtBu( 0x200, 0x200 );
    2102           0 :         SvMemoryStream  aClientTextBox( 0x200, 0x200 );
    2103           0 :         ImplWriteTextStyleAtom( aClientTextBox, nStyleInstance, 0, NULL, aExtBu, &aPropOpt );
    2104             : 
    2105           0 :         aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, true );
    2106           0 :         aPropOpt.CreateShapeProperties( mXShape );
    2107           0 :         aPropOpt.Commit( *mpStrm );
    2108           0 :         mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
    2109           0 :         mpStrm->WriteInt16( (sal_Int16)maRect.Top() ).WriteInt16( (sal_Int16)maRect.Left() ).WriteInt16( (sal_Int16)maRect.Right() ).WriteInt16( (sal_Int16)maRect.Bottom() );      // oben, links, rechts, unten ????
    2110           0 :         mpPptEscherEx->OpenContainer( ESCHER_ClientData );
    2111           0 :         mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
    2112           0 :         mpStrm->WriteUInt32( (sal_uInt32)0 )                // PlacementID
    2113           0 :                .WriteUChar( (sal_uInt8)nPlaceHolderId )    // PlaceHolderID
    2114           0 :                .WriteUChar( (sal_uInt8)0 )                 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
    2115           0 :                .WriteUInt16( (sal_uInt16)0 );               // padword
    2116           0 :         mpPptEscherEx->CloseContainer();        // ESCHER_ClientData
    2117             : 
    2118           0 :         if ( aClientTextBox.Tell() )
    2119             :         {
    2120           0 :             mpStrm->WriteUInt32( (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf ) )
    2121           0 :                    .WriteUInt32( (sal_uInt32)aClientTextBox.Tell() );
    2122             : 
    2123           0 :             mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
    2124             :         }
    2125           0 :         mpPptEscherEx->CloseContainer();    // ESCHER_SpContainer
    2126             :     }
    2127             :     else
    2128           0 :         bRet = sal_False;
    2129           0 :     return bRet;
    2130             : }
    2131             : 
    2132           0 : void PPTWriter::ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& rSolver )
    2133             : {
    2134           0 :     sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
    2135           0 :     mpPptEscherEx->AddShape( nType, nFlags, nId );
    2136           0 :     rSolver.AddShape( mXShape, nId );
    2137           0 : }
    2138             : 
    2139           0 : void PPTWriter::ImplCreateTextShape( EscherPropertyContainer& rPropOpt, EscherSolverContainer& rSolver, sal_Bool bFill )
    2140             : {
    2141           0 :     mnTextStyle = EPP_TEXTSTYLE_TEXT;
    2142           0 :     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2143           0 :     ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
    2144           0 :     if ( bFill )
    2145           0 :         rPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2146           0 :     if ( ImplGetText() )
    2147           0 :         rPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, true );
    2148           0 : }
    2149             : 
    2150           0 : void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& aSolverContainer, PageType ePageType, sal_Bool bMasterPage, int nPageNumber )
    2151             : {
    2152             :     // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    2153             :     // sal_uInt32  nGroupLevel = 0;
    2154             : 
    2155             :     sal_uInt32  nInstance, nGroups, nShapes, nShapeCount, nPer, nLastPer, nIndices, nOlePictureId;
    2156             :     sal_uInt16  nEffectCount;
    2157           0 :     ::com::sun::star::awt::Point   aTextRefPoint;
    2158             : 
    2159           0 :     ResetGroupTable( nShapes = mXShapes->getCount() );
    2160             : 
    2161           0 :     nIndices = nInstance = nLastPer = nShapeCount = nEffectCount = 0;
    2162             : 
    2163           0 :     sal_Bool bIsTitlePossible = sal_True;           // powerpoint is not able to handle more than one title
    2164             : 
    2165           0 :     sal_uInt32  nOutlinerCount = 0;                 // the outline objects have to conform to the layout,
    2166           0 :     sal_uInt32  nPrevTextStyle = 0;                 // there are no more than two allowed
    2167             : 
    2168           0 :     nOlePictureId = 0;
    2169             : 
    2170           0 :     sal_Bool bAdditionalText = sal_False;
    2171             : 
    2172           0 :     sal_Bool bSecOutl = sal_False;
    2173           0 :     sal_uInt32 nPObjects = 0;
    2174             : 
    2175           0 :     SvMemoryStream* pClientTextBox = NULL;
    2176           0 :     SvMemoryStream* pClientData = NULL;
    2177             : 
    2178           0 :     while( GetNextGroupEntry() )
    2179             :     {
    2180           0 :         nShapeCount++;
    2181             : 
    2182           0 :         nPer = ( 5 * nShapeCount ) / nShapes;
    2183           0 :         if ( nPer != nLastPer )
    2184             :         {
    2185           0 :             nLastPer = nPer;
    2186           0 :             sal_uInt32 nValue = mnPagesWritten * 5 + nPer;
    2187           0 :             if ( nValue > mnStatMaxValue )
    2188           0 :                 nValue = mnStatMaxValue;
    2189           0 :             if ( mbStatusIndicator && ( nValue > mnLatestStatValue ) )
    2190             :             {
    2191           0 :                 mXStatusIndicator->setValue( nValue );
    2192           0 :                 mnLatestStatValue = nValue;
    2193             :             }
    2194             :         }
    2195           0 :         nGroups = GetGroupsClosed();
    2196           0 :         for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
    2197             : 
    2198           0 :         if ( GetShapeByIndex( GetCurrentGroupIndex(), sal_True ) )
    2199             :         {
    2200             :             sal_Bool bIsSound;
    2201           0 :             sal_Bool bMediaClickAction = sal_False;
    2202             :             ::com::sun::star::presentation::AnimationEffect eAe;
    2203             :             ::com::sun::star::presentation::AnimationEffect eTe;
    2204             : 
    2205           0 :             if ( ImplGetPropertyValue( OUString( "PresentationOrder" ) ) )
    2206           0 :                 nEffectCount = *(sal_uInt16*)mAny.getValue();
    2207             : 
    2208           0 :             sal_Bool bEffect = ImplGetEffect( mXPropSet, eAe, eTe, bIsSound );
    2209           0 :             ::com::sun::star::presentation::ClickAction eCa = ::com::sun::star::presentation::ClickAction_NONE;
    2210           0 :             if ( ImplGetPropertyValue( OUString( "OnClick" ) ) )
    2211           0 :                 mAny >>= eCa;
    2212             : 
    2213           0 :             sal_Bool bGroup = mType == "drawing.Group";
    2214           0 :             sal_Bool bOpenBezier   = mType == "drawing.OpenBezier";
    2215           0 :             sal_Bool bClosedBezier = mType == "drawing.ClosedBezier";
    2216           0 :             sal_Bool bPolyPolygon  = mType == "drawing.PolyPolygon";
    2217           0 :             sal_Bool bPolyLine = mType == "drawing.PolyLine";
    2218             : 
    2219           0 :             const ::com::sun::star::awt::Size   aSize100thmm( mXShape->getSize() );
    2220           0 :             const ::com::sun::star::awt::Point  aPoint100thmm( mXShape->getPosition() );
    2221           0 :             Rectangle   aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
    2222           0 :             EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect100thmm );
    2223             : 
    2224           0 :             if ( bGroup )
    2225             :             {
    2226           0 :                 SvMemoryStream* pTmp = NULL;
    2227             :                 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
    2228           0 :                     aXIndexAccess( mXShape, ::com::sun::star::uno::UNO_QUERY );
    2229           0 :                 if ( EnterGroup( aXIndexAccess ) )
    2230             :                 {
    2231           0 :                     if ( bEffect && !mbUseNewAnimations )
    2232             :                     {
    2233           0 :                         pTmp = new SvMemoryStream( 0x200, 0x200 );
    2234           0 :                         ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
    2235             :                     }
    2236           0 :                     if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
    2237             :                     {
    2238           0 :                         if ( !pTmp )
    2239           0 :                             pTmp = new SvMemoryStream( 0x200, 0x200 );
    2240           0 :                         ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
    2241             :                     }
    2242           0 :                     sal_uInt32 nShapeId = mpPptEscherEx->EnterGroup( &maRect, pTmp );
    2243           0 :                     aSolverContainer.AddShape( mXShape, nShapeId );
    2244           0 :                     delete pTmp;
    2245           0 :                 }
    2246             :             }
    2247             :             else
    2248             :             {
    2249           0 :                 sal_Bool bIsFontwork = sal_False;
    2250           0 :                 sal_Bool bIsHatching = sal_False;
    2251           0 :                 ::com::sun::star::uno::Any aAny;
    2252             :                 ::com::sun::star::drawing::FillStyle eFS;
    2253           0 :                 if ( GetPropertyValue( aAny, mXPropSet, OUString( "IsFontwork" ), sal_True ) )
    2254           0 :                     aAny >>= bIsFontwork;
    2255           0 :                 if ( GetPropertyValue( aAny, mXPropSet, OUString( "FillStyle" ), sal_True ) )
    2256             :                 {
    2257           0 :                     aAny >>= eFS;
    2258           0 :                     bIsHatching = eFS == ::com::sun::star::drawing::FillStyle_HATCH;
    2259             :                 }
    2260           0 :                 if ( bIsHatching || bIsFontwork || ( mType == "drawing.Measure" ) || ( mType == "drawing.Caption" ) )
    2261             :                 {
    2262           0 :                     if ( ImplGetPropertyValue( OUString( "BoundRect" ) ) )
    2263             :                     {
    2264           0 :                         ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)mAny.getValue() );
    2265           0 :                         maPosition = MapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) );
    2266           0 :                         maSize = MapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) );
    2267           0 :                         maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
    2268             :                     }
    2269           0 :                     mType = "drawing.dontknow";
    2270           0 :                 }
    2271             :             }
    2272           0 :             sal_uInt8 nPlaceHolderAtom = EPP_PLACEHOLDER_NONE;
    2273             : 
    2274           0 :             mnTextSize = 0;
    2275           0 :             mnTextStyle = EPP_TEXTSTYLE_NORMAL;
    2276             : 
    2277           0 :             if ( mType == "drawing.Custom" )
    2278             :             {
    2279           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2280             :                 sal_uInt32 nMirrorFlags;
    2281           0 :                 OUString sCustomShapeType;
    2282           0 :                 MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( mXShape, nMirrorFlags, sCustomShapeType );
    2283           0 :                 if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == "col-60da8460" )
    2284             :                 {   // sj: creating metafile for customshapes that can't be saved to ms format properly
    2285           0 :                     ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
    2286           0 :                     if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "MetaFile" ), false ) )
    2287             :                     {
    2288           0 :                         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    2289           0 :                         SdrObject* pObj = GetSdrObjectFromXShape( mXShape );
    2290           0 :                         if ( pObj )
    2291             :                         {
    2292           0 :                             Rectangle aBound = pObj->GetCurrentBoundRect();
    2293           0 :                             maPosition = MapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) );
    2294           0 :                             maSize = MapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) );
    2295           0 :                             maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
    2296           0 :                             mnAngle = 0;
    2297             :                         }
    2298             :                     }
    2299             :                 }
    2300             :                 else
    2301             :                 {
    2302           0 :                     ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, aSolverContainer );
    2303           0 :                     aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
    2304           0 :                     aPropOpt.CreateFillProperties( mXPropSet, true, mXShape);
    2305           0 :                     if ( ImplGetText() )
    2306             :                     {
    2307           0 :                         if ( !aPropOpt.IsFontWork() )
    2308           0 :                             aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, true, true );
    2309             :                     }
    2310           0 :                 }
    2311             :             }
    2312           0 :             else if ( mType == "drawing.Rectangle" )
    2313             :             {
    2314           0 :                 sal_Int32 nRadius = 0;
    2315           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2316           0 :                 if ( ImplGetPropertyValue( OUString( "CornerRadius" ) ) )
    2317             :                 {
    2318           0 :                     mAny >>= nRadius;
    2319           0 :                     nRadius = MapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width;
    2320             :                 }
    2321           0 :                 if ( nRadius )
    2322             :                 {
    2323           0 :                     ImplCreateShape( ESCHER_ShpInst_RoundRectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
    2324           0 :                     sal_Int32 nLength = maRect.GetWidth();
    2325           0 :                     if ( nLength > maRect.GetHeight() )
    2326           0 :                         nLength = maRect.GetHeight();
    2327           0 :                     nLength >>= 1;
    2328           0 :                     if ( nRadius >= nLength )
    2329           0 :                         nRadius = 0x2a30;                           // 0x2a30 ist PPTs maximum radius
    2330             :                     else
    2331           0 :                         nRadius = ( 0x2a30 * nRadius ) / nLength;
    2332           0 :                     aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
    2333             :                 }
    2334             :                 else
    2335             :                 {
    2336           0 :                     ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer );          // Flags: Connector | HasSpt
    2337             :                 }
    2338           0 :                 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2339           0 :                 if ( ImplGetText() )
    2340           0 :                     aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, false );
    2341             :             }
    2342           0 :             else if ( mType == "drawing.Ellipse" )
    2343             :             {
    2344           0 :                 ::com::sun::star::drawing::CircleKind  eCircleKind( ::com::sun::star::drawing::CircleKind_FULL );
    2345           0 :                 PolyStyle ePolyKind = POLY_CHORD;
    2346           0 :                 if ( ImplGetPropertyValue( OUString( "CircleKind" ) ) )
    2347             :                 {
    2348           0 :                     mAny >>= eCircleKind;
    2349           0 :                     switch ( eCircleKind )
    2350             :                     {
    2351             :                         case ::com::sun::star::drawing::CircleKind_SECTION :
    2352             :                         {
    2353           0 :                             ePolyKind = POLY_PIE;
    2354             :                         }
    2355           0 :                         break;
    2356             :                         case ::com::sun::star::drawing::CircleKind_ARC :
    2357             :                         {
    2358           0 :                             ePolyKind = POLY_ARC;
    2359             :                         }
    2360           0 :                         break;
    2361             : 
    2362             :                         case ::com::sun::star::drawing::CircleKind_CUT :
    2363             :                         {
    2364           0 :                             ePolyKind = POLY_CHORD;
    2365             :                         }
    2366           0 :                         break;
    2367             : 
    2368             :                         default:
    2369           0 :                             eCircleKind = ::com::sun::star::drawing::CircleKind_FULL;
    2370             :                     }
    2371             :                 }
    2372           0 :                 if ( eCircleKind == ::com::sun::star::drawing::CircleKind_FULL )
    2373             :                 {
    2374           0 :                     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2375           0 :                     ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
    2376           0 :                     aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2377           0 :                     if ( ImplGetText() )
    2378           0 :                         aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, false );
    2379             :                 }
    2380             :                 else
    2381             :                 {
    2382             :                     sal_Int32 nStartAngle, nEndAngle;
    2383           0 :                     if ( !ImplGetPropertyValue( OUString( "CircleStartAngle" ) ) )
    2384           0 :                         continue;
    2385           0 :                     nStartAngle = *( (sal_Int32*)mAny.getValue() );
    2386           0 :                     if( !ImplGetPropertyValue( OUString( "CircleEndAngle" ) ) )
    2387           0 :                         continue;
    2388           0 :                     nEndAngle = *( (sal_Int32*)mAny.getValue() );
    2389           0 :                     ::com::sun::star::awt::Point aPoint( mXShape->getPosition() );
    2390           0 :                     ::com::sun::star::awt::Size  aSize( mXShape->getSize() );
    2391           0 :                     ::com::sun::star::awt::Point aStart, aEnd, aCenter;
    2392           0 :                     Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
    2393           0 :                     aStart.X = (sal_Int32)( ( cos( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
    2394           0 :                     aStart.Y = - (sal_Int32)( ( sin( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
    2395           0 :                     aEnd.X = (sal_Int32)( ( cos( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
    2396           0 :                     aEnd.Y = - (sal_Int32)( ( sin( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
    2397           0 :                     aCenter.X = aPoint.X + ( aSize.Width / 2 );
    2398           0 :                     aCenter.Y = aPoint.Y + ( aSize.Height / 2 );
    2399           0 :                     aStart.X += aCenter.X;
    2400           0 :                     aStart.Y += aCenter.Y;
    2401           0 :                     aEnd.X += aCenter.X;
    2402           0 :                     aEnd.Y += aCenter.Y;
    2403           0 :                     Polygon aPolygon( aRect, Point( aStart.X, aStart.Y ), Point( aEnd.X, aEnd.Y ), ePolyKind );
    2404           0 :                     sal_Bool bNeedText = sal_True;
    2405           0 :                     if ( mnAngle )
    2406             :                     {
    2407           0 :                         aPolygon.Rotate( aRect.TopLeft(), (sal_uInt16)( mnAngle / 10 ) );
    2408           0 :                         if ( ImplGetText() )
    2409             :                         {
    2410             :                             // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    2411             :                             // mpPptEscherEx->EnterGroup( 0,0 );
    2412             :                             // nGroupLevel = mpPptEscherEx->GetGroupLevel();
    2413           0 :                             bNeedText = sal_False;
    2414           0 :                             bAdditionalText = sal_True;
    2415           0 :                             mnTextSize = 0;
    2416             :                         }
    2417           0 :                         mnAngle = 0;
    2418             :                     }
    2419           0 :                     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2420           0 :                     ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );       // Flags: Connector | HasSpt
    2421           0 :                     ::com::sun::star::awt::Rectangle aNewRect;
    2422           0 :                     switch ( ePolyKind )
    2423             :                     {
    2424             :                         case POLY_PIE :
    2425             :                         case POLY_CHORD :
    2426             :                         {
    2427           0 :                             if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, false, aNewRect, &aPolygon ) )
    2428           0 :                                 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2429             :                         }
    2430           0 :                         break;
    2431             : 
    2432             :                         case POLY_ARC :
    2433             :                         {
    2434           0 :                             if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, false, aNewRect, &aPolygon ) )
    2435           0 :                                 aPropOpt.CreateLineProperties( mXPropSet, false );
    2436             :                         }
    2437           0 :                         break;
    2438             :                     }
    2439           0 :                     maRect = MapRectangle( aNewRect );
    2440           0 :                     maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2441           0 :                     maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
    2442           0 :                     if ( bNeedText && ImplGetText() )
    2443           0 :                         aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, false );
    2444             :                 }
    2445             :             }
    2446           0 :             else if ( mType == "drawing.Control" )
    2447             :             {
    2448             :                 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XControlShape  >
    2449           0 :                     aXControlShape( mXShape, ::com::sun::star::uno::UNO_QUERY );
    2450           0 :                 if ( !aXControlShape.is() )
    2451           0 :                     continue;
    2452             :                 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
    2453           0 :                     aXControlModel( aXControlShape->getControl() );
    2454           0 :                 if ( !aXControlModel.is() )
    2455           0 :                     continue;
    2456             : 
    2457           0 :                 sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
    2458             :                 try
    2459             :                 {
    2460             :                     // try to get the aspect when available
    2461             :                     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
    2462           0 :                         xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
    2463           0 :                     xShapeProps->getPropertyValue("Aspect") >>= nAspect;
    2464             :                 }
    2465           0 :                 catch( ::com::sun::star::uno::Exception& )
    2466             :                 {}
    2467             : 
    2468           0 :                 mpExEmbed->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_ExControl << 16 ) ) )
    2469           0 :                            .WriteUInt32( (sal_uInt32)0 );               // Size of this container
    2470             : 
    2471           0 :                 sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
    2472             : 
    2473           0 :                 sal_uInt32 nPageId = nPageNumber;
    2474           0 :                 if ( ePageType == MASTER )
    2475           0 :                     nPageId |= 0x80000000;
    2476             :                 else
    2477           0 :                     nPageId += 0x100;
    2478           0 :                 mpExEmbed->WriteUInt32( (sal_uInt32)( EPP_ExControlAtom << 16 ) )
    2479           0 :                            .WriteUInt32( (sal_uInt32)4 )
    2480           0 :                            .WriteUInt32( nPageId );
    2481           0 :                 PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() );
    2482           0 :                 pEntry->xControlModel = aXControlModel;
    2483           0 :                 pEntry->xShape = mXShape;
    2484           0 :                 maExOleObj.push_back( pEntry );
    2485             : 
    2486           0 :                 mnExEmbed++;
    2487             : 
    2488           0 :                 mpExEmbed->WriteUInt32( (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) ) )
    2489           0 :                            .WriteUInt32( (sal_uInt32)24 )
    2490           0 :                            .WriteUInt32( (sal_uInt32)nAspect )
    2491           0 :                            .WriteUInt32( (sal_uInt32)2 )
    2492           0 :                            .WriteUInt32( (sal_uInt32)mnExEmbed )
    2493           0 :                            .WriteUInt32( (sal_uInt32)0 )
    2494           0 :                            .WriteUInt32( (sal_uInt32)4 )    // index to the persist table
    2495           0 :                            .WriteUInt32( (sal_uInt32)0x0012de00 );
    2496             : 
    2497           0 :                 ::com::sun::star::awt::Size     aSize;
    2498           0 :                 OUString          aControlName;
    2499           0 :                 SvStorageRef    xTemp( new SvStorage( new SvMemoryStream(), true ) );
    2500           0 :                 if ( oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xTemp, aXControlModel, aSize, aControlName ) )
    2501             :                 {
    2502           0 :                     OUString aUserName( xTemp->GetUserName() );
    2503           0 :                     OUString aOleIdentifier;
    2504           0 :                     if ( !aUserName.isEmpty() )
    2505             :                     {
    2506             :                         SvStorageStreamRef xCompObj = xTemp->OpenSotStream(
    2507             :                             OUString( "\1CompObj" ),
    2508           0 :                                 STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL );
    2509           0 :                         xCompObj->Seek( STREAM_SEEK_TO_END );
    2510           0 :                         sal_uInt32  nStreamLen = xCompObj->Tell();
    2511           0 :                         xCompObj->Seek( 0 );
    2512             :                         sal_Int16   nVersion, nByteOrder;
    2513             :                         sal_Int32   nWinVersion, nVal, nStringLen;
    2514           0 :                         xCompObj->ReadInt16( nVersion )
    2515           0 :                                  .ReadInt16( nByteOrder )
    2516           0 :                                  .ReadInt32( nWinVersion )
    2517           0 :                                  .ReadInt32( nVal );
    2518           0 :                         xCompObj->SeekRel( 16 );    // skipping clsid
    2519           0 :                         xCompObj->ReadInt32( nStringLen );
    2520           0 :                         if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
    2521             :                         {
    2522           0 :                             xCompObj->SeekRel( nStringLen );        // now skipping the UserName;
    2523           0 :                             xCompObj->ReadInt32( nStringLen );
    2524           0 :                             if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
    2525             :                             {
    2526           0 :                                 xCompObj->SeekRel( nStringLen );    // now skipping the clipboard formatname
    2527           0 :                                 xCompObj->ReadInt32( nStringLen );
    2528           0 :                                 if ( ( nStringLen > 1 ) && ( ( xCompObj->Tell() + nStringLen ) < nStreamLen ) )
    2529             :                                 {   // i think that the OleIdentifier will follow
    2530           0 :                                     OString aTemp = read_uInt8s_ToOString(*xCompObj, nStringLen - 1);
    2531           0 :                                     aOleIdentifier = OStringToOUString(aTemp, RTL_TEXTENCODING_MS_1252);
    2532             :                                 }
    2533             :                             }
    2534           0 :                         }
    2535             :                     }
    2536             : 
    2537           0 :                     PPTWriter::WriteCString( *mpExEmbed, aControlName, 1 );
    2538           0 :                     PPTWriter::WriteCString( *mpExEmbed, aOleIdentifier, 2 );
    2539           0 :                     PPTWriter::WriteCString( *mpExEmbed, aUserName, 3 );
    2540             :                 }
    2541           0 :                 nSize = mpExEmbed->Tell() - nOldPos;
    2542           0 :                 mpExEmbed->Seek( nOldPos - 4 );
    2543           0 :                 mpExEmbed->WriteUInt32( nSize );
    2544           0 :                 mpExEmbed->Seek( STREAM_SEEK_TO_END );
    2545           0 :                 nOlePictureId = mnExEmbed;
    2546             : 
    2547           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2548           0 :                 sal_uInt32 nSpFlags = SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE;
    2549           0 :                 ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer );
    2550           0 :                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "MetaFile" ), false  ) )
    2551           0 :                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    2552             :                 //export form control graphic
    2553           0 :                 else if ( aPropOpt.CreateBlipPropertiesforOLEControl(mXPropSet,mXShape))
    2554           0 :                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    2555           0 :                 aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed );
    2556           0 :                 aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
    2557             : 
    2558           0 :                 if ( !aControlName.isEmpty() )
    2559             :                 {
    2560             :                     sal_uInt16 i, nBufSize;
    2561           0 :                     nBufSize = ( aControlName.getLength() + 1 ) << 1;
    2562           0 :                     sal_uInt8* pBuf = new sal_uInt8[ nBufSize ];
    2563           0 :                     sal_uInt8* pTmp = pBuf;
    2564           0 :                     for ( i = 0; i < aControlName.getLength(); i++ )
    2565             :                     {
    2566           0 :                         sal_Unicode nUnicode = *(aControlName.getStr() + i);
    2567           0 :                         *pTmp++ = (sal_uInt8)nUnicode;
    2568           0 :                         *pTmp++ = (sal_uInt8)( nUnicode >> 8 );
    2569             :                     }
    2570           0 :                     *pTmp++ = 0;
    2571           0 :                     *pTmp = 0;
    2572           0 :                     aPropOpt.AddOpt( ESCHER_Prop_wzName, true, nBufSize, pBuf, nBufSize );
    2573           0 :                 }
    2574             :             }
    2575           0 :             else if ( mType == "drawing.Connector" )
    2576             :             {
    2577             :                 sal_uInt16 nSpType, nSpFlags;
    2578           0 :                 ::com::sun::star::awt::Rectangle aNewRect;
    2579           0 :                 if ( aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) == false )
    2580           0 :                     continue;
    2581             : 
    2582           0 :                 maRect = MapRectangle( aNewRect );
    2583           0 :                 maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2584           0 :                 maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
    2585             : 
    2586           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2587           0 :                 ImplCreateShape( nSpType, nSpFlags, aSolverContainer );
    2588             : 
    2589             :                 // #119459# for connector shape, the start point and end point is fixed, and should not be rotated.
    2590           0 :                 mnAngle = 0;
    2591             :             }
    2592           0 :             else if ( mType == "drawing.Measure" )
    2593             :             {
    2594           0 :                 continue;
    2595             :             }
    2596           0 :             else if ( mType == "drawing.Line" )
    2597             :             {
    2598           0 :                 ::com::sun::star::awt::Rectangle aNewRect;
    2599           0 :                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_LINE, false, aNewRect, NULL );
    2600           0 :                 maRect = MapRectangle( aNewRect );
    2601           0 :                 maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2602           0 :                 maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
    2603           0 :                 if ( ImplGetText() )
    2604             :                 {
    2605           0 :                     aTextRefPoint = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2606           0 :                     mnTextSize = 0;
    2607           0 :                     bAdditionalText = sal_True;
    2608             :                     // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    2609             :                     // mpPptEscherEx->EnterGroup( &maRect,0 );
    2610             :                 }
    2611           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2612           0 :                 sal_uInt32 nFlags = 0xa00;                                  // Flags: Connector | HasSpt
    2613           0 :                 if ( maRect.Top() > maRect.Bottom() )
    2614           0 :                     nFlags |= 0x80;                                         // Flags: VertMirror
    2615           0 :                 if ( maRect.Left() > maRect.Right() )
    2616           0 :                     nFlags |= 0x40;                                         // Flags: HorzMirror
    2617             : 
    2618           0 :                 ImplCreateShape( ESCHER_ShpInst_Line, nFlags, aSolverContainer );
    2619           0 :                 aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
    2620           0 :                 aPropOpt.CreateLineProperties( mXPropSet, false );
    2621           0 :                 mnAngle = 0;
    2622             :             }
    2623           0 :             else if ( bPolyPolygon )
    2624             :             {
    2625           0 :                 if ( ImplGetText() )
    2626             :                 {
    2627             :                     // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    2628             :                     // mpPptEscherEx->EnterGroup( 0,0 );
    2629             :                     // nGroupLevel = mpPptEscherEx->GetGroupLevel();
    2630           0 :                     bAdditionalText = sal_True;
    2631           0 :                     mnTextSize = 0;
    2632             :                 }
    2633           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2634           0 :                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
    2635           0 :                 ::com::sun::star::awt::Rectangle aNewRect;
    2636           0 :                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, false, aNewRect, NULL );
    2637           0 :                 maRect = MapRectangle( aNewRect );
    2638           0 :                 maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2639           0 :                 maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
    2640           0 :                 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2641           0 :                 mnAngle = 0;
    2642             :             }
    2643           0 :             else if ( bPolyLine )
    2644             :             {
    2645           0 :                 if ( ImplGetText() )
    2646             :                 {
    2647             :                     // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    2648             :                     // mpPptEscherEx->EnterGroup( 0,0 );
    2649             :                     // nGroupLevel = mpPptEscherEx->GetGroupLevel();
    2650           0 :                     bAdditionalText = sal_True;
    2651           0 :                     mnTextSize = 0;
    2652             :                 }
    2653           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2654           0 :                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
    2655           0 :                 ::com::sun::star::awt::Rectangle aNewRect;
    2656           0 :                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, false, aNewRect, NULL );
    2657           0 :                 maRect = MapRectangle( aNewRect );
    2658           0 :                 maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2659           0 :                 maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
    2660           0 :                 aPropOpt.CreateLineProperties( mXPropSet, false );
    2661           0 :                 mnAngle = 0;
    2662             :             }
    2663           0 :             else if ( bOpenBezier )
    2664             :             {
    2665           0 :                 if ( ImplGetText() )
    2666             :                 {
    2667             :                     // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    2668             :                     // mpPptEscherEx->EnterGroup( 0,0 );
    2669             :                     // nGroupLevel = mpPptEscherEx->GetGroupLevel();
    2670           0 :                     bAdditionalText = sal_True;
    2671           0 :                     mnTextSize = 0;
    2672             :                 }
    2673           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2674           0 :                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
    2675           0 :                 ::com::sun::star::awt::Rectangle aNewRect;
    2676           0 :                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, true, aNewRect, NULL );
    2677           0 :                 maRect = MapRectangle( aNewRect );
    2678           0 :                 maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2679           0 :                 maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
    2680           0 :                 aPropOpt.CreateLineProperties( mXPropSet, false );
    2681           0 :                 mnAngle = 0;
    2682             :             }
    2683           0 :             else if ( bClosedBezier )
    2684             :             {
    2685           0 :                 if ( ImplGetText() )
    2686             :                 {
    2687             :                     // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    2688             :                     // mpPptEscherEx->EnterGroup( 0,0 );
    2689             :                     // nGroupLevel = mpPptEscherEx->GetGroupLevel();
    2690           0 :                     bAdditionalText = sal_True;
    2691           0 :                     mnTextSize = 0;
    2692             :                 }
    2693           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2694           0 :                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
    2695           0 :                 ::com::sun::star::awt::Rectangle aNewRect;
    2696           0 :                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, true, aNewRect, NULL );
    2697           0 :                 maRect = MapRectangle( aNewRect );
    2698           0 :                 maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
    2699           0 :                 maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
    2700           0 :                 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2701           0 :                 mnAngle = 0;
    2702             :             }
    2703           0 :             else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
    2704             :             {
    2705           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2706             : 
    2707             :                 // a GraphicObject can also be a ClickMe element
    2708           0 :                 if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
    2709             :                 {
    2710           0 :                     nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
    2711           0 :                     ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );           // Flags: HaveAnchor | HaveMaster
    2712           0 :                     aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
    2713           0 :                     aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
    2714           0 :                     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
    2715           0 :                     aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
    2716             :                 }
    2717             :                 else
    2718             :                 {
    2719           0 :                     mXText = ::com::sun::star::uno::Reference<
    2720             :                         ::com::sun::star::text::XSimpleText >
    2721           0 :                             ( mXShape, ::com::sun::star::uno::UNO_QUERY );
    2722             : 
    2723           0 :                     if ( mXText.is() )
    2724           0 :                         mnTextSize = mXText->getString().getLength();
    2725             : 
    2726           0 :                     if ( mnTextSize )                                       // graphic object or area fill
    2727             :                     {
    2728             :                         /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
    2729             :                         have to create a simpe Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
    2730             :                         */
    2731           0 :                         ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer );       // Flags: Connector | HasSpt
    2732           0 :                         if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "GraphicURL" ), true, true, false ) )
    2733             :                         {
    2734           0 :                             aPropOpt.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
    2735           0 :                             aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
    2736           0 :                             aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
    2737           0 :                             aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
    2738           0 :                             aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
    2739           0 :                             if ( ImplGetText() )
    2740           0 :                                 aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, false );
    2741             :                         }
    2742             :                     }
    2743             :                     else
    2744             :                     {
    2745           0 :                         ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
    2746             : 
    2747           0 :                         if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "GraphicURL" ), false, true ) )
    2748             :                         {
    2749           0 :                             aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    2750             :                         }
    2751             :                     }
    2752             :                 }
    2753             :             }
    2754           0 :             else if ( ( mType == "drawing.Text" ) || ( mType == "presentation.Notes" ) )
    2755             :             {
    2756           0 :                 if ( ( ePageType == NOTICE ) && mbPresObj )
    2757             :                 {
    2758           0 :                     if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE ) )
    2759           0 :                         continue;
    2760             :                     else
    2761           0 :                         nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESBODY;
    2762             :                 }
    2763           0 :                 ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    2764             :             }
    2765           0 :             else if ( mType == "presentation.TitleText" )
    2766             :             {
    2767           0 :                 if ( mbPresObj )
    2768             :                 {
    2769           0 :                     if ( ( ePageType == NOTICE ) && mbEmptyPresObj )
    2770             :                     {
    2771           0 :                         mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2772           0 :                         nPlaceHolderAtom = EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE;
    2773           0 :                         ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x200, aSolverContainer );
    2774           0 :                         aPropOpt.CreateLineProperties( mXPropSet, false );
    2775           0 :                         aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
    2776             :                     }
    2777           0 :                     else if ( rLayout.bTitlePossible && bIsTitlePossible )
    2778             :                     {
    2779           0 :                         bIsTitlePossible = sal_False;
    2780             : 
    2781           0 :                         ImplGetText();
    2782           0 :                         TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this );
    2783           0 :                         if ( ePageType == MASTER )
    2784             :                         {
    2785           0 :                             if ( mnTextSize )
    2786             :                             {
    2787           0 :                                 OUString aUString( mXText->getString() );
    2788             :                                 sal_uInt16 nChar;
    2789             : 
    2790           0 :                                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2791           0 :                                 mnShapeMasterTitle = mpPptEscherEx->GenerateShapeId();
    2792           0 :                                 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterTitle );// Flags: HaveAnchor | HasSpt
    2793           0 :                                 EscherPropertyContainer aPropertyOptions;
    2794           0 :                                 aPropertyOptions.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
    2795           0 :                                 aPropertyOptions.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
    2796           0 :                                 aPropertyOptions.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
    2797           0 :                                 aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
    2798           0 :                                 aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
    2799           0 :                                 aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
    2800           0 :                                 aPropertyOptions.CreateFillProperties( mXPropSet, true, mXShape );
    2801           0 :                                 sal_uInt32 nLineFlags = 0x90001;
    2802           0 :                                 if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
    2803           0 :                                     nLineFlags |= 0x10001;  // draw dashed line if no line
    2804           0 :                                 aPropertyOptions.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
    2805           0 :                                 aPropertyOptions.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, true );
    2806           0 :                                 ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
    2807           0 :                                 aPropertyOptions.Commit( *mpStrm );
    2808           0 :                                 mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
    2809           0 :                                 mpStrm->WriteInt16( (sal_Int16)maRect.Top() ).WriteInt16( (sal_Int16)maRect.Left() ).WriteInt16( (sal_Int16)maRect.Right() ).WriteInt16( (sal_Int16)maRect.Bottom() );      // top, left, right, bottom ????
    2810           0 :                                 mpPptEscherEx->OpenContainer( ESCHER_ClientData );
    2811           0 :                                 mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
    2812           0 :                                 mpStrm->WriteUInt32( (sal_uInt32)0 )                                                        // PlacementID
    2813           0 :                                        .WriteUChar( (sal_uInt8)EPP_PLACEHOLDER_MASTERTITLE )                               // PlaceHolderID
    2814           0 :                                        .WriteUChar( (sal_uInt8)0 )                                                         // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
    2815           0 :                                        .WriteUInt16( (sal_uInt16)0 );                                                       // padword
    2816           0 :                                 mpPptEscherEx->CloseContainer();    // ESCHER_ClientData
    2817           0 :                                 mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox );
    2818           0 :                                 mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
    2819           0 :                                 mpStrm->WriteUInt32( (sal_uInt32)EPP_TEXTTYPE_Title );
    2820           0 :                                 mpPptEscherEx->AddAtom( mnTextSize << 1, EPP_TextCharsAtom );
    2821           0 :                                 const sal_Unicode* pString = aUString.getStr();
    2822           0 :                                 for ( sal_uInt32 i = 0; i < mnTextSize; i++ )
    2823             :                                 {
    2824           0 :                                     nChar = pString[ i ];       // 0xa -> 0xb soft newline
    2825           0 :                                     if ( nChar == 0xa )
    2826           0 :                                         nChar++;                // 0xd -> 0xd hard newline
    2827           0 :                                     mpStrm->WriteUInt16( nChar );
    2828             :                                 }
    2829           0 :                                 mpPptEscherEx->AddAtom( 6, EPP_BaseTextPropAtom );
    2830           0 :                                 mpStrm->WriteUInt32( (sal_uInt32)( mnTextSize + 1 ) ).WriteUInt16( (sal_uInt16)0 );
    2831           0 :                                 mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
    2832           0 :                                 mpStrm->WriteUInt32( (sal_uInt32)( mnTextSize + 1 ) ).WriteUInt32( (sal_uInt32)1 ).WriteUInt16( (sal_uInt16)0 );
    2833           0 :                                 mpPptEscherEx->CloseContainer();    // ESCHER_ClientTextBox
    2834           0 :                                 mpPptEscherEx->CloseContainer();    // ESCHER_SpContainer
    2835             :                             }
    2836           0 :                             continue;
    2837             :                         }
    2838             :                         else
    2839             :                         {
    2840           0 :                             mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2841           0 :                             mnTextStyle = EPP_TEXTSTYLE_TITLE;
    2842           0 :                             nPlaceHolderAtom = rLayout.nTypeOfTitle;
    2843           0 :                             ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );          // Flags: HaveAnchor | HaveMaster
    2844           0 :                             aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterTitle );
    2845           0 :                             aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2846           0 :                             aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, true );
    2847           0 :                             ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
    2848           0 :                             if ( mbEmptyPresObj )
    2849             :                             {
    2850           0 :                                 sal_uInt32 nNoLineDrawDash = 0;
    2851           0 :                                 aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
    2852           0 :                                 nNoLineDrawDash |= 0x10001;
    2853           0 :                                 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
    2854             :                             }
    2855           0 :                         }
    2856             :                     }
    2857             :                     else
    2858           0 :                         mbPresObj = sal_False;
    2859             :                 }
    2860           0 :                 if ( !mbPresObj )
    2861             :                 {
    2862           0 :                     mType = "drawing.Text";
    2863           0 :                     ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    2864             :                 }
    2865             :             }
    2866           0 :             else if ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) )
    2867             :             {
    2868           0 :                 if ( mbPresObj )
    2869             :                 {
    2870           0 :                     nOutlinerCount++;
    2871           0 :                     if ( (rLayout.bOutlinerPossible && ( nOutlinerCount == 1 )) ||
    2872           0 :                          (( rLayout.bSecOutlinerPossible && ( nOutlinerCount == 2 ) ) && ( nPrevTextStyle == EPP_TEXTSTYLE_BODY ))
    2873             :                        )
    2874             :                     {
    2875           0 :                         ImplGetText();
    2876           0 :                         TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this );
    2877           0 :                         if ( ePageType == MASTER )
    2878             :                         {
    2879           0 :                             nPrevTextStyle = EPP_TEXTSTYLE_TITLE;
    2880           0 :                             if ( mnTextSize )
    2881             :                             {
    2882           0 :                                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2883           0 :                                 mnShapeMasterBody = mpPptEscherEx->GenerateShapeId();
    2884           0 :                                 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterBody );  // Flags: HaveAnchor | HasSpt
    2885           0 :                                 EscherPropertyContainer aPropOpt2;
    2886           0 :                                 aPropOpt2.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
    2887           0 :                                 aPropOpt2.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
    2888           0 :                                 aPropOpt2.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
    2889           0 :                                 aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
    2890           0 :                                 aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
    2891           0 :                                 aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
    2892           0 :                                 aPropOpt2.CreateFillProperties( mXPropSet, true, mXShape  );
    2893           0 :                                 sal_uInt32 nLineFlags = 0x90001;
    2894           0 :                                 if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
    2895           0 :                                     nLineFlags |= 0x10001;  // draw dashed line if no line
    2896           0 :                                 aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
    2897           0 :                                 aPropOpt2.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, true );
    2898           0 :                                 ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt2 );
    2899           0 :                                 aPropOpt2.Commit( *mpStrm );
    2900           0 :                                 mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
    2901           0 :                                 mpStrm->WriteInt16( (sal_Int16)maRect.Top() ).WriteInt16( (sal_Int16)maRect.Left() ).WriteInt16( (sal_Int16)maRect.Right() ).WriteInt16( (sal_Int16)maRect.Bottom() );  // top, left, right, bottom ????
    2902           0 :                                 mpPptEscherEx->OpenContainer( ESCHER_ClientData );
    2903           0 :                                 mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
    2904           0 :                                 sal_uInt8 PlaceHolderID = ( mType == "presentation.Subtitle") ? EPP_PLACEHOLDER_MASTERSUBTITLE:EPP_PLACEHOLDER_MASTERBODY;
    2905           0 :                                 mpStrm->WriteUInt32( (sal_uInt32)1 )                                                        // PlacementID
    2906           0 :                                        .WriteUChar( PlaceHolderID )/*(sal_uInt8)EPP_PLACEHOLDER_MASTERBODY */                                   // PlaceHolderID
    2907           0 :                                        .WriteUChar( (sal_uInt8)0 )                                                         // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
    2908           0 :                                        .WriteUInt16( (sal_uInt16)0 );                                                       // padword
    2909           0 :                                 mpPptEscherEx->CloseContainer();    // ESCHER_ClientData
    2910           0 :                                 mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox );       // printf
    2911           0 :                                 mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
    2912           0 :                                 if ( mType == "presentation.Subtitle")
    2913           0 :                                     mpStrm->WriteUInt32( (sal_uInt32)EPP_TEXTTYPE_CenterBody );
    2914             :                                 else
    2915           0 :                                     mpStrm->WriteUInt32( (sal_uInt32)EPP_TEXTTYPE_Body );
    2916           0 :                                 mnTextSize = aTextObj.Count();
    2917           0 :                                 aTextObj.Write( mpStrm );
    2918           0 :                                 mpPptEscherEx->BeginAtom();
    2919           0 :                                 for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount() ; ++i )
    2920             :                                 {
    2921           0 :                                     ParagraphObj* pPara = aTextObj.GetParagraph(i);
    2922           0 :                                     sal_uInt32 nCharCount = pPara->CharacterCount();
    2923           0 :                                     sal_uInt16 nDepth = pPara->nDepth;
    2924           0 :                                     if ( nDepth > 4)
    2925           0 :                                         nDepth = 4;
    2926             : 
    2927           0 :                                     mpStrm->WriteUInt32( nCharCount )
    2928           0 :                                            .WriteUInt16( nDepth );
    2929             :                                 }
    2930           0 :                                 mpPptEscherEx->EndAtom( EPP_BaseTextPropAtom );
    2931           0 :                                 mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
    2932           0 :                                 mpStrm->WriteUInt32( (sal_uInt32)( mnTextSize ) ).WriteUInt32( (sal_uInt32)1 ).WriteUInt16( (sal_uInt16)0 );
    2933             : 
    2934           0 :                                 mpPptEscherEx->CloseContainer();    // ESCHER_ClientTextBox
    2935           0 :                                 mpPptEscherEx->CloseContainer();    // ESCHER_SpContainer
    2936             :                             }
    2937           0 :                             continue;
    2938             :                         }
    2939             :                         else
    2940             :                         {
    2941           0 :                             mnTextStyle = EPP_TEXTSTYLE_BODY;
    2942           0 :                             nPlaceHolderAtom = rLayout.nTypeOfOutliner;
    2943           0 :                             mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2944           0 :                             ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );          // Flags: HaveAnchor | HaveMaster
    2945           0 :                             aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
    2946           0 :                             aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
    2947           0 :                             aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, true );
    2948           0 :                             ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
    2949           0 :                             if ( mbEmptyPresObj )
    2950             :                             {
    2951           0 :                                 sal_uInt32 nNoLineDrawDash = 0;
    2952           0 :                                 aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
    2953           0 :                                 nNoLineDrawDash |= 0x10001;
    2954           0 :                                 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
    2955             :                             }
    2956           0 :                         }
    2957             :                     }
    2958             :                     else
    2959           0 :                         mbPresObj = false;
    2960             :                 }
    2961           0 :                 if ( !mbPresObj )
    2962             :                 {
    2963           0 :                     if (ePageType == MASTER )
    2964             :                     {
    2965           0 :                         SdrObject* pObj = GetSdrObjectFromXShape( mXShape );
    2966           0 :                         if (pObj && pObj->IsNotVisibleAsMaster())
    2967           0 :                             continue;
    2968             :                     }
    2969             : 
    2970           0 :                     mType = "drawing.Text";
    2971           0 :                     ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    2972             :                 }
    2973             :             }
    2974           0 :             else if ( ( mType == "drawing.Page" ) || ( mType == "presentation.Page" ) )
    2975             :             {
    2976           0 :                 if ( ( ePageType == NOTICE ) && mbPresObj )
    2977             :                 {
    2978           0 :                     if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) )
    2979           0 :                         continue;
    2980             :                     else
    2981           0 :                         nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESSLIDEIMAGE;
    2982             :                 }
    2983           0 :                 ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    2984             :             }
    2985           0 :             else if ( mType == "drawing.Frame" )
    2986             :             {
    2987           0 :                 continue;
    2988             :             }
    2989           0 :             else if ( ( mType == "drawing.OLE2" ) || ( mType == "presentation.OLE2" )
    2990           0 :                         || ( mType == "presentation.Chart" ) || ( mType == "presentation.Calc" )
    2991           0 :                             || ( mType == "presentation.OrgChart" ) )
    2992             :             {
    2993           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    2994           0 :                 if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
    2995             :                 {
    2996           0 :                     nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
    2997           0 :                     ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );              // Flags: HaveAnchor | HaveMaster
    2998           0 :                     aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
    2999           0 :                     aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
    3000           0 :                     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
    3001           0 :                     aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
    3002             :                 }
    3003             :                 else
    3004             :                 {
    3005           0 :                     mpExEmbed->WriteUInt32( (sal_uInt32)( 0xf | ( EPP_ExEmbed << 16 ) ) )
    3006           0 :                                .WriteUInt32( (sal_uInt32)0 );               // Size of this container
    3007             : 
    3008           0 :                     sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
    3009             : 
    3010           0 :                     mpExEmbed->WriteUInt32( (sal_uInt32)( EPP_ExEmbedAtom << 16 ) )
    3011           0 :                                .WriteUInt32( (sal_uInt32)8 )
    3012           0 :                                .WriteUInt32( (sal_uInt32)0 )    // follow colorscheme : 0->do not follow
    3013             :                                                     //                      1->follow collorscheme
    3014             :                                                     //                      2->follow text and background scheme
    3015           0 :                                .WriteUChar( (sal_uInt8)1 )     // (bool)set if embedded server can not be locked
    3016           0 :                                .WriteUChar( (sal_uInt8)0 )     // (bool)do not need to send dimension
    3017           0 :                                .WriteUChar( (sal_uInt8)0 )     // (bool)is object a world table
    3018           0 :                                .WriteUChar( (sal_uInt8)0 );    // pad byte
    3019             : 
    3020           0 :                     PPTExOleObjEntry* pE = new PPTExOleObjEntry( NORMAL_OLE_OBJECT, mpExEmbed->Tell() );
    3021           0 :                     pE->xShape = mXShape;
    3022           0 :                     maExOleObj.push_back( pE );
    3023             : 
    3024           0 :                     mnExEmbed++;
    3025             : 
    3026           0 :                     sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
    3027             :                     try
    3028             :                     {
    3029             :                         // try to get the aspect when available
    3030             :                         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
    3031           0 :                             xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
    3032           0 :                         xShapeProps->getPropertyValue("Aspect") >>= nAspect;
    3033             :                     }
    3034           0 :                     catch( ::com::sun::star::uno::Exception& )
    3035             :                     {}
    3036             : 
    3037           0 :                     mpExEmbed->WriteUInt32( (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) ) )
    3038           0 :                                .WriteUInt32( (sal_uInt32)24 )
    3039           0 :                                .WriteUInt32( (sal_uInt32)nAspect )      // Aspect
    3040           0 :                                .WriteUInt32( (sal_uInt32)0 )
    3041           0 :                                .WriteUInt32( (sal_uInt32)mnExEmbed )    // index to the persist table
    3042           0 :                                .WriteUInt32( (sal_uInt32)0 )            // subtype
    3043           0 :                                .WriteUInt32( (sal_uInt32)0 )
    3044           0 :                                .WriteUInt32( (sal_uInt32)0x0012b600 );
    3045             : 
    3046           0 :                     nSize = mpExEmbed->Tell() - nOldPos;
    3047           0 :                     mpExEmbed->Seek( nOldPos - 4 );
    3048           0 :                     mpExEmbed->WriteUInt32( nSize );
    3049           0 :                     mpExEmbed->Seek( STREAM_SEEK_TO_END );
    3050           0 :                     nOlePictureId = mnExEmbed;
    3051             : 
    3052           0 :                     sal_uInt32 nSpFlags = 0xa00;
    3053           0 :                     if ( nOlePictureId )
    3054           0 :                         nSpFlags |= 0x10;
    3055           0 :                     ImplCreateShape( ESCHER_ShpInst_PictureFrame, nSpFlags, aSolverContainer );
    3056           0 :                     if ( aPropOpt.CreateOLEGraphicProperties( mXShape ) )
    3057           0 :                         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    3058           0 :                     if ( nOlePictureId )
    3059           0 :                         aPropOpt.AddOpt( ESCHER_Prop_pictureId, nOlePictureId );
    3060             :                 }
    3061             :             }
    3062           0 :             else if ( mType == "presentation.Header" )
    3063             :             {
    3064           0 :                 if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERHEADER ) )
    3065           0 :                     continue;
    3066             :                 else
    3067             :                 {
    3068           0 :                     mbPresObj = sal_False;
    3069           0 :                     mType = "drawing.Text";
    3070           0 :                     ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    3071             :                 }
    3072             :             }
    3073           0 :             else if ( mType == "presentation.Footer" )
    3074             :             {
    3075           0 :                 if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERFOOTER ) )
    3076           0 :                     continue;
    3077             :                 else
    3078             :                 {
    3079           0 :                     mbPresObj = sal_False;
    3080           0 :                     mType = "drawing.Text";
    3081           0 :                     ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    3082             :                 }
    3083             :             }
    3084           0 :             else if ( mType == "presentation.DateTime" )
    3085             :             {
    3086           0 :                 if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERDATE ) )
    3087           0 :                     continue;
    3088             :                 else
    3089             :                 {
    3090           0 :                     mbPresObj = sal_False;
    3091           0 :                     mType = "drawing.Text";
    3092           0 :                     ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    3093             :                 }
    3094             :             }
    3095           0 :             else if ( mType == "presentation.SlideNumber" )
    3096             :             {
    3097           0 :                 if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERSLIDENUMBER ) )
    3098           0 :                     continue;
    3099             :                 else
    3100             :                 {
    3101           0 :                     mbPresObj = sal_False;
    3102           0 :                     mType = "drawing.Text";
    3103           0 :                     ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
    3104             :                 }
    3105             :             }
    3106           0 :             else if ( (mType.getLength() > 9) && (mType[8] == '3') && (mType[9] == 'D') )  // drawing.3D
    3107             :             {
    3108             :                 // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
    3109           0 :                 if ( !ImplGetPropertyValue( OUString( "Bitmap" ) ) )
    3110           0 :                     continue;
    3111             : 
    3112           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    3113           0 :                 ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
    3114             : 
    3115           0 :                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "Bitmap" ), false ) )
    3116           0 :                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    3117             :             }
    3118           0 :             else if ( mType == "drawing.Media" )
    3119             :             {
    3120           0 :                 mnAngle = 0;
    3121           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    3122           0 :                 ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
    3123           0 :                 if ( aPropOpt.CreateMediaGraphicProperties( mXShape ) )
    3124           0 :                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    3125           0 :                 ::com::sun::star::uno::Any aAny;
    3126           0 :                 if ( PropValue::GetPropertyValue( aAny, mXPropSet, OUString( "MediaURL" ), true ) )
    3127             :                 {
    3128           0 :                     OUString aMediaURL;
    3129           0 :                     if ( (aAny >>= aMediaURL ) &&  !aMediaURL.isEmpty() )
    3130             :                     {
    3131             :                         // SJ: creating the Media RefObj
    3132           0 :                         sal_uInt32 nRefId = ++mnExEmbed;
    3133             : 
    3134           0 :                         mpExEmbed->WriteUInt16( (sal_uInt16)0xf )
    3135           0 :                                    .WriteUInt16( (sal_uInt16)EPP_ExMCIMovie )       // PPT_PST_ExAviMovie
    3136           0 :                                    .WriteUInt32( (sal_uInt32)0 );
    3137           0 :                         sal_uInt32 nSize, nStart = mpExEmbed->Tell();
    3138           0 :                         mpExEmbed->WriteUInt16( (sal_uInt16)0 )
    3139           0 :                                    .WriteUInt16( (sal_uInt16)EPP_ExObjRefAtom )
    3140           0 :                                    .WriteUInt32( (sal_uInt32)4 )
    3141           0 :                                    .WriteUInt32( nRefId );
    3142           0 :                         mpExEmbed->WriteUInt16( (sal_uInt16)0xf )
    3143           0 :                                    .WriteUInt16( (sal_uInt16)EPP_ExVideo )
    3144           0 :                                    .WriteUInt32( (sal_uInt32)0 );
    3145             : 
    3146           0 :                         mpExEmbed->WriteUInt16( (sal_uInt16)0 )
    3147           0 :                                    .WriteUInt16( (sal_uInt16)EPP_ExMediaAtom )
    3148           0 :                                    .WriteUInt32( (sal_uInt32)8 )
    3149           0 :                                    .WriteUInt32( nRefId )
    3150           0 :                                    .WriteUInt16( (sal_uInt16)0 )
    3151           0 :                                    .WriteUInt16( (sal_uInt16)0x435 );
    3152             : 
    3153           0 :                         sal_uInt16 i, nStringLen = (sal_uInt16)aMediaURL.getLength();
    3154           0 :                         mpExEmbed->WriteUInt32( (sal_uInt32)( EPP_CString << 16 ) ).WriteUInt32( (sal_uInt32)( nStringLen * 2 ) );
    3155           0 :                         for ( i = 0; i < nStringLen; i++ )
    3156             :                         {
    3157           0 :                             sal_Unicode nChar = aMediaURL[ i ];
    3158           0 :                             mpExEmbed->WriteUInt16( nChar );
    3159             :                         }
    3160           0 :                         nSize = mpExEmbed->Tell() - nStart;
    3161           0 :                         mpExEmbed->SeekRel( - ( (sal_Int32)nSize + 4 ) );
    3162           0 :                         mpExEmbed->WriteUInt32( nSize );    // size of PPT_PST_ExMCIMovie
    3163           0 :                         mpExEmbed->SeekRel( 0x10 );
    3164           0 :                         nSize -= 20;
    3165           0 :                         mpExEmbed->WriteUInt32( nSize );    // PPT_PST_ExMediaAtom
    3166           0 :                         mpExEmbed->SeekRel( nSize );
    3167             : 
    3168           0 :                         if ( !pClientData )
    3169           0 :                             pClientData = new SvMemoryStream( 0x200, 0x200 );
    3170           0 :                         pClientData->WriteUInt16( (sal_uInt16)0 )
    3171           0 :                                     .WriteUInt16( (sal_uInt16)EPP_ExObjRefAtom )
    3172           0 :                                     .WriteUInt32( (sal_uInt32)4 )
    3173           0 :                                     .WriteUInt32( nRefId );
    3174             :                         // write EPP_InteractiveInfo container for no_action
    3175           0 :                         pClientData->WriteUInt32( (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) ).WriteUInt32( (sal_uInt32)24 );
    3176           0 :                         pClientData->WriteUInt16( (sal_uInt16)0 )
    3177           0 :                                     .WriteUInt16( (sal_uInt16)EPP_InteractiveInfoAtom )
    3178           0 :                                     .WriteUInt32( (sal_uInt32)16 )
    3179           0 :                                     .WriteUInt32( (sal_uInt32) 0 )
    3180           0 :                                     .WriteUInt32( (sal_uInt32) 0 )
    3181           0 :                                     .WriteUChar( (sal_uInt8) 6 )
    3182           0 :                                     .WriteUChar( (sal_uInt8) 0 )
    3183           0 :                                     .WriteUChar( (sal_uInt8) 0 )
    3184           0 :                                     .WriteUChar( (sal_uInt8) 0 )
    3185           0 :                                     .WriteUInt32( (sal_uInt32) 0 );
    3186           0 :                     }
    3187           0 :                 }
    3188             :             }
    3189           0 :             else if ( (mType == "drawing.Table") || (mType == "presentation.Table") )
    3190             :             {
    3191           0 :                 SvMemoryStream* pTmp = NULL;
    3192           0 :                 if ( bEffect && !mbUseNewAnimations )
    3193             :                 {
    3194           0 :                     pTmp = new SvMemoryStream( 0x200, 0x200 );
    3195           0 :                     ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
    3196             :                 }
    3197           0 :                 if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
    3198             :                 {
    3199           0 :                     if ( !pTmp )
    3200           0 :                         pTmp = new SvMemoryStream( 0x200, 0x200 );
    3201           0 :                     ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
    3202             :                 }
    3203           0 :                 ImplCreateTable( mXShape, aSolverContainer, aPropOpt );
    3204           0 :                 continue;
    3205             :             }
    3206           0 :             else if ( mType == "drawing.dontknow" )
    3207             :             {
    3208           0 :                 mnAngle = 0;
    3209           0 :                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    3210           0 :                 ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
    3211           0 :                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "MetaFile" ), false ) )
    3212           0 :                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
    3213             :             }
    3214             :             else
    3215             :             {
    3216           0 :                 continue;
    3217             :             }
    3218             : 
    3219           0 :             sal_Bool bClientData = ( bEffect || ( eCa != ::com::sun::star::presentation::ClickAction_NONE ) ||
    3220           0 :                                         nPlaceHolderAtom || nOlePictureId );
    3221           0 :             if ( bClientData )
    3222             :             {
    3223           0 :                 if ( nPlaceHolderAtom )
    3224             :                 {
    3225           0 :                     sal_Int32 nPlacementID = -1;
    3226           0 :                     if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
    3227           0 :                         nPlacementID = nIndices++;
    3228             :                     else
    3229             :                     {
    3230           0 :                         switch ( nPlaceHolderAtom )
    3231             :                         {
    3232             :                             default :
    3233             :                             {
    3234           0 :                                 if ( nPlaceHolderAtom < 19 )
    3235           0 :                                     break;
    3236             :                             }
    3237             :                             case EPP_PLACEHOLDER_NOTESBODY :
    3238             :                             case EPP_PLACEHOLDER_MASTERDATE :
    3239             :                             case EPP_PLACEHOLDER_NOTESSLIDEIMAGE :
    3240             :                             case EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE :
    3241           0 :                                 nPlacementID = nIndices++;
    3242             :                         }
    3243             :                     }
    3244           0 :                     if ( !pClientData )
    3245           0 :                         pClientData = new SvMemoryStream( 0x200, 0x200 );
    3246             : 
    3247           0 :                     pClientData->WriteUInt32( (sal_uInt32)( EPP_OEPlaceholderAtom << 16 ) ).WriteUInt32( (sal_uInt32)8 )
    3248           0 :                                 .WriteInt32( nPlacementID )                // PlacementID
    3249           0 :                                 .WriteUChar( (sal_uInt8)nPlaceHolderAtom ) // PlaceHolderID
    3250           0 :                                 .WriteUChar( (sal_uInt8)0 )                // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
    3251           0 :                                 .WriteUInt16( (sal_uInt16)0 );              // padword
    3252             :                 }
    3253           0 :                 if ( nOlePictureId )
    3254             :                 {
    3255           0 :                     if ( !pClientData )
    3256           0 :                         pClientData = new SvMemoryStream( 0x200, 0x200 );
    3257             : 
    3258           0 :                     pClientData->WriteUInt32( (sal_uInt32)( EPP_ExObjRefAtom << 16 ) ).WriteUInt32( (sal_uInt32)4 )
    3259           0 :                                 .WriteUInt32( nOlePictureId );
    3260           0 :                     nOlePictureId = 0;
    3261             :                 }
    3262           0 :                 if ( bEffect )
    3263             :                 {
    3264           0 :                     if ( !pClientData )
    3265           0 :                         pClientData = new SvMemoryStream( 0x200, 0x200 );
    3266             : 
    3267             :                     // check if it is sensible to replace the object effect with text effect,
    3268             :                     // because in Impress there is the possibility to use a compound effect,
    3269             :                     // e.g. the object effect is an AnimationEffect_FADE_FROM_LEFT and the
    3270             :                     // text effect is a AnimationEffect_FADE_FROM_TOP, in PowerPoint there
    3271             :                     // can be used only one effect
    3272           0 :                     if ( mnTextSize && ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
    3273           0 :                         && ( eAe != ::com::sun::star::presentation::AnimationEffect_NONE )
    3274           0 :                             && ( eTe != eAe ) )
    3275             :                     {
    3276             :                         sal_uInt32 nFillStyleFlags, nLineStyleFlags;
    3277           0 :                         if ( aPropOpt.GetOpt( ESCHER_Prop_fNoFillHitTest, nFillStyleFlags )
    3278           0 :                             && aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineStyleFlags ) )
    3279             :                         {
    3280             :                             // there is no fillstyle and also no linestyle
    3281           0 :                             if ( ! ( ( nFillStyleFlags & 0x10 ) + ( nLineStyleFlags & 9 ) ) )
    3282           0 :                                 eAe = eTe;
    3283             :                         }
    3284             :                     }
    3285           0 :                     if ( !mbUseNewAnimations  )
    3286           0 :                         ImplWriteObjectEffect( *pClientData, eAe, eTe, ++nEffectCount );
    3287             :                 }
    3288             : 
    3289           0 :                 if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
    3290             :                 {
    3291           0 :                     if ( !pClientData )
    3292           0 :                         pClientData = new SvMemoryStream( 0x200, 0x200 );
    3293           0 :                     ImplWriteClickAction( *pClientData, eCa, bMediaClickAction );
    3294             :                 }
    3295             :             }
    3296           0 :             if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
    3297             :             {
    3298           0 :                 if ( !pClientTextBox )
    3299           0 :                     pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
    3300             : 
    3301           0 :                 if ( mbEmptyPresObj == sal_False )
    3302             :                 {
    3303           0 :                     if ( ( ePageType == NORMAL ) && ( bMasterPage == sal_False ) )
    3304             :                     {
    3305           0 :                         sal_uInt32 nTextType = EPP_TEXTTYPE_Body;
    3306           0 :                         if ( mnTextStyle == EPP_TEXTSTYLE_BODY )
    3307             :                         {
    3308           0 :                             if ( bSecOutl )
    3309           0 :                                 nTextType = EPP_TEXTTYPE_HalfBody;
    3310           0 :                             else if ( mType == "presentation.Subtitle" )
    3311           0 :                                 nTextType = EPP_TEXTTYPE_CenterBody;
    3312           0 :                             bSecOutl = sal_True;
    3313             :                         }
    3314             :                         else
    3315           0 :                             nTextType = EPP_TEXTTYPE_Title;
    3316             : 
    3317           0 :                         TextRuleEntry aTextRule( nPageNumber );
    3318           0 :                         SvMemoryStream aExtBu( 0x200, 0x200 );
    3319           0 :                         ImplGetText();
    3320           0 :                         ImplWriteTextStyleAtom( *pClientTextBox, nTextType, nPObjects, &aTextRule, aExtBu, NULL );
    3321           0 :                         ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, nPageNumber + 0x100 );
    3322           0 :                         SvMemoryStream* pOut = aTextRule.pOut;
    3323           0 :                         if ( pOut )
    3324             :                         {
    3325           0 :                             pClientTextBox->Write( pOut->GetData(), pOut->Tell() );
    3326           0 :                             delete pOut, aTextRule.pOut = NULL;
    3327             :                         }
    3328           0 :                         if ( aExtBu.Tell() )
    3329             :                         {
    3330           0 :                             if ( !pClientData )
    3331           0 :                                 pClientData = new SvMemoryStream( 0x200, 0x200 );
    3332           0 :                             ImplProgTagContainer( pClientData, &aExtBu );
    3333           0 :                         }
    3334             :                     }
    3335           0 :                 }
    3336             :             }
    3337             :             else
    3338             :             {
    3339           0 :                 if ( !aPropOpt.IsFontWork() )
    3340             :                 {
    3341           0 :                     if ( mnTextSize || ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
    3342             :                     {
    3343             :                         int nInstance2;
    3344           0 :                         if ( ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
    3345           0 :                             nInstance2 = 2;
    3346             :                         else
    3347           0 :                             nInstance2 = EPP_TEXTTYPE_Other;     // Text in a Shape
    3348             : 
    3349           0 :                         if ( !pClientTextBox )
    3350           0 :                             pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
    3351             : 
    3352           0 :                         SvMemoryStream  aExtBu( 0x200, 0x200 );
    3353           0 :                         ImplWriteTextStyleAtom( *pClientTextBox, nInstance2, 0, NULL, aExtBu, &aPropOpt );
    3354           0 :                         if ( aExtBu.Tell() )
    3355             :                         {
    3356           0 :                             if ( !pClientData )
    3357           0 :                                 pClientData = new SvMemoryStream( 0x200, 0x200 );
    3358           0 :                             ImplProgTagContainer( pClientData, &aExtBu );
    3359           0 :                         }
    3360             :                     }
    3361           0 :                     else if ( nPlaceHolderAtom >= 19 )
    3362             :                     {
    3363           0 :                         if ( !pClientTextBox )
    3364           0 :                             pClientTextBox = new SvMemoryStream( 12 );
    3365             : 
    3366           0 :                         pClientTextBox->WriteUInt32( (sal_uInt32)( EPP_TextHeaderAtom << 16 ) ).WriteUInt32( (sal_uInt32)4 )
    3367           0 :                                        .WriteUInt32( (sal_uInt32)7 );
    3368             :                     }
    3369             :                 }
    3370             :             }
    3371             : 
    3372           0 :             aPropOpt.CreateShadowProperties( mXPropSet );
    3373           0 :             maRect.Justify();
    3374           0 :             if ( mnAngle )
    3375           0 :                 ImplFlipBoundingBox( aPropOpt );
    3376           0 :             aPropOpt.CreateShapeProperties( mXShape );
    3377           0 :             aPropOpt.Commit( *mpStrm );
    3378           0 :             if ( GetCurrentGroupLevel() > 0 )
    3379           0 :                 mpPptEscherEx->AddChildAnchor( maRect );
    3380             :             else
    3381           0 :                 mpPptEscherEx->AddClientAnchor( maRect );
    3382             : 
    3383           0 :             if ( pClientData )
    3384             :             {
    3385           0 :                 mpStrm->WriteUInt32( (sal_uInt32)( ( ESCHER_ClientData << 16 ) | 0xf ) )
    3386           0 :                        .WriteUInt32( (sal_uInt32)pClientData->Tell() );
    3387             : 
    3388           0 :                 mpStrm->Write( pClientData->GetData(), pClientData->Tell() );
    3389           0 :                 delete pClientData, pClientData = NULL;
    3390             :             }
    3391           0 :             if ( pClientTextBox )
    3392             :             {
    3393           0 :                 mpStrm->WriteUInt32( (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf ) )
    3394           0 :                        .WriteUInt32( (sal_uInt32)pClientTextBox->Tell() );
    3395             : 
    3396           0 :                 mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
    3397           0 :                 delete pClientTextBox, pClientTextBox = NULL;
    3398             :             }
    3399           0 :             mpPptEscherEx->CloseContainer();      // ESCHER_SpContainer
    3400             :         }
    3401           0 :         nPrevTextStyle = mnTextStyle;
    3402             : 
    3403           0 :         if ( bAdditionalText )
    3404             :         {
    3405           0 :             bAdditionalText = sal_False;
    3406             : 
    3407           0 :             ::com::sun::star::uno::Any  aAny;
    3408           0 :             EscherPropertyContainer     aPropOpt;
    3409             :             mnAngle = ( PropValue::GetPropertyValue( aAny,
    3410           0 :                 mXPropSet, OUString( "RotateAngle" ), sal_True ) )
    3411           0 :                     ? *((sal_Int32*)aAny.getValue() )
    3412           0 :                     : 0;
    3413             : 
    3414           0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
    3415           0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
    3416           0 :             if ( mType == "drawing.Line" )
    3417             :             {
    3418           0 :                 double fDist = hypot( maRect.GetWidth(), maRect.GetHeight() );
    3419             :                 maRect = Rectangle( Point( aTextRefPoint.X, aTextRefPoint.Y ),
    3420           0 :                                         Point( (sal_Int32)( aTextRefPoint.X + fDist ), aTextRefPoint.Y - 1 ) );
    3421           0 :                 ImplCreateTextShape( aPropOpt, aSolverContainer, sal_False );
    3422           0 :                 aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 );        // Size Shape To Fit Text
    3423           0 :                 if ( mnAngle < 0 )
    3424           0 :                     mnAngle = ( 36000 + mnAngle ) % 36000;
    3425           0 :                 if ( mnAngle )
    3426           0 :                     ImplFlipBoundingBox( aPropOpt );
    3427             :             }
    3428             :             else
    3429             :             {
    3430           0 :                 ImplCreateTextShape( aPropOpt, aSolverContainer, sal_False );
    3431           0 :                 if ( mnAngle < 0 )
    3432           0 :                     mnAngle = ( 36000 + mnAngle ) % 36000;
    3433             :                 else
    3434           0 :                     mnAngle = ( 36000 - ( mnAngle % 36000 ) );
    3435             : 
    3436           0 :                 mnAngle *= 655;
    3437           0 :                 mnAngle += 0x8000;
    3438           0 :                 mnAngle &=~0xffff;  // round nAngle to full grad
    3439           0 :                 aPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
    3440             : 
    3441             :                 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    3442             :                 // mpPptEscherEx->SetGroupSnapRect( nGroupLevel, maRect );
    3443             :                 // mpPptEscherEx->SetGroupLogicRect( nGroupLevel, maRect );
    3444             :             }
    3445           0 :             if ( !pClientTextBox )
    3446           0 :                 pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
    3447             : 
    3448           0 :             SvMemoryStream  aExtBu( 0x200, 0x200 );
    3449           0 :             ImplWriteTextStyleAtom( *pClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOpt );
    3450             : 
    3451           0 :             aPropOpt.CreateShapeProperties( mXShape );
    3452           0 :             aPropOpt.Commit( *mpStrm );
    3453           0 :             if ( GetCurrentGroupLevel() > 0 )
    3454           0 :                 mpPptEscherEx->AddChildAnchor( maRect );
    3455             :             else
    3456           0 :                 mpPptEscherEx->AddClientAnchor( maRect );
    3457             : 
    3458           0 :             mpStrm->WriteUInt32( (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf ) )
    3459           0 :                    .WriteUInt32( (sal_uInt32)pClientTextBox->Tell() );
    3460             : 
    3461           0 :             mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
    3462           0 :             delete pClientTextBox, pClientTextBox = NULL;
    3463             : 
    3464           0 :             mpPptEscherEx->CloseContainer();  // ESCHER_SpContainer
    3465             : 
    3466             :             // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
    3467             :             // mpPptEscherEx->LeaveGroup();
    3468             :         }
    3469             :     }
    3470           0 :     ClearGroupTable();                              // storing groups if any are still open, which should not be the case
    3471           0 :     nGroups = GetGroupsClosed();
    3472           0 :     for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
    3473           0 :     mnPagesWritten++;
    3474           0 : }
    3475             : 
    3476             : struct CellBorder
    3477             : {
    3478             :     sal_Int32                       mnPos;      // specifies the distance to the top/left position of the table
    3479             :     sal_Int32                       mnLength;
    3480             :     table::BorderLine               maCellBorder;
    3481             : 
    3482           0 :     CellBorder() : mnPos ( 0 ), mnLength( 0 ){};
    3483             : };
    3484             : 
    3485           0 : sal_Bool PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2)
    3486             : {
    3487           0 :     sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
    3488           0 :     if ( nLineWidth )
    3489             :     {
    3490           0 :         nLineWidth *= 2;
    3491           0 :         mnAngle = 0;
    3492           0 :         mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    3493           0 :         EscherPropertyContainer aPropOptSp;
    3494             : 
    3495           0 :         sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
    3496           0 :         mpPptEscherEx->AddShape( ESCHER_ShpInst_Line, 0xa02, nId );
    3497           0 :         aPropOptSp.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
    3498           0 :         aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0xa0008 );
    3499           0 :         aPropOptSp.AddOpt( ESCHER_Prop_fshadowObscured, 0x20000 );
    3500             : 
    3501           0 :         sal_uInt32 nBorderColor = pCellBorder->maCellBorder.Color & 0xff00;                 // green
    3502           0 :         nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color ) << 16;  // red
    3503           0 :         nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color >> 16 );  // blue
    3504           0 :         aPropOptSp.AddOpt( ESCHER_Prop_lineColor, nBorderColor );
    3505             : 
    3506           0 :         aPropOptSp.AddOpt( ESCHER_Prop_lineWidth, nLineWidth * 360 );
    3507           0 :         aPropOptSp.AddOpt( ESCHER_Prop_fc3DLightFace, 0x80000 );
    3508           0 :         aPropOptSp.Commit( *mpStrm );
    3509           0 :         mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
    3510           0 :         mpStrm    ->WriteInt32( nX1 )
    3511           0 :                    .WriteInt32( nY1 )
    3512           0 :                    .WriteInt32( nX2 )
    3513           0 :                    .WriteInt32( nY2 );
    3514           0 :         mpPptEscherEx->CloseContainer();
    3515           0 :         return sal_True;
    3516             :     }
    3517           0 :     return sal_False;
    3518             : }
    3519             : 
    3520             : //get merged cell's width
    3521           0 : sal_Int32 GetCellRight( sal_Int32 nColumn,
    3522             :     Rectangle& rect,
    3523             :     std::vector< std::pair< sal_Int32, sal_Int32 > >& aColumns,
    3524             :     uno::Reference< table::XMergeableCell >& xCell )
    3525             : {
    3526           0 :     sal_Int32 nRight = aColumns[ nColumn ].first + aColumns[ nColumn ].second;
    3527           0 :     for ( sal_Int32 nColumnSpan = 1; nColumnSpan < xCell->getColumnSpan(); nColumnSpan++ )
    3528             :     {
    3529           0 :         sal_uInt32 nC = nColumnSpan + nColumn;
    3530           0 :         if ( nC < aColumns.size() )
    3531           0 :             nRight += aColumns[ nC ].second;
    3532             :         else
    3533           0 :             nRight = rect.Right();
    3534             :     }
    3535           0 :     return nRight;
    3536             : }
    3537             : //get merged cell's height
    3538           0 : sal_Int32 GetCellBottom( sal_Int32 nRow,
    3539             :     Rectangle& rect,
    3540             :     std::vector< std::pair< sal_Int32, sal_Int32 > >& aRows,
    3541             :     uno::Reference< table::XMergeableCell >& xCell )
    3542             : {
    3543           0 :     sal_Int32 nBottom = aRows[nRow].first + aRows[nRow].second;
    3544           0 :     for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
    3545             :     {
    3546           0 :         sal_uInt32 nR = nRowSpan + nRow;
    3547           0 :         if ( nR < aRows.size() )
    3548           0 :             nBottom += aRows[ nR ].second;
    3549             :         else
    3550           0 :             nBottom = rect.Bottom();
    3551             :     }
    3552           0 :     return nBottom;
    3553             : }
    3554             : 
    3555           0 : void PPTWriter::WriteCString( SvStream& rSt, const OUString& rString, sal_uInt32 nInstance )
    3556             : {
    3557           0 :     sal_Int32 nLen = rString.getLength();
    3558           0 :     if ( nLen )
    3559             :     {
    3560           0 :         rSt.WriteUInt32( (sal_uInt32)( ( nInstance << 4 ) | ( EPP_CString << 16 ) ) )
    3561           0 :            .WriteUInt32( (sal_uInt32)( nLen << 1 ) );
    3562           0 :         for ( sal_Int32 i = 0; i < nLen; i++ )
    3563           0 :             rSt.WriteUInt16( rString[i] );
    3564             :     }
    3565           0 : }
    3566             : 
    3567           0 : void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
    3568             :                                 EscherPropertyContainer& aPropOpt )
    3569             : {
    3570             :     try
    3571             :     {
    3572           0 :         static const OUString  sModel( "Model" );
    3573           0 :         static const OUString sWidth( "Width" );
    3574           0 :         static const OUString sHeight( "Height" );
    3575             : 
    3576           0 :         uno::Reference< table::XTable > xTable;
    3577           0 :         if ( mXPropSet->getPropertyValue( sModel ) >>= xTable )
    3578             :         {
    3579           0 :             uno::Reference< table::XColumnRowRange > xColumnRowRange( xTable, uno::UNO_QUERY_THROW );
    3580           0 :             uno::Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW );
    3581           0 :             uno::Reference< container::XIndexAccess > xRows( xColumnRowRange->getRows(), uno::UNO_QUERY_THROW );
    3582           0 :             sal_uInt16 nRowCount = static_cast< sal_uInt16 >( xRows->getCount() );
    3583           0 :             sal_uInt16 nColumnCount = static_cast< sal_uInt16 >( xColumns->getCount() );
    3584             : 
    3585           0 :             std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns;
    3586           0 :             std::vector< std::pair< sal_Int32, sal_Int32 > > aRows;
    3587             : 
    3588           0 :             awt::Point aPosition( MapPoint( rXShape->getPosition() ) );
    3589           0 :             sal_Int32 nPosition = aPosition.X;
    3590           0 :             for ( sal_Int32 x = 0; x < nColumnCount; x++ )
    3591             :             {
    3592           0 :                 uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW );
    3593           0 :                 awt::Size aS( 0, 0 );
    3594           0 :                 xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
    3595           0 :                 awt::Size aM( MapSize( aS ) );
    3596           0 :                 aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) );
    3597           0 :                 nPosition += aM.Width;
    3598           0 :                 if ( x == nColumnCount - 1  && nPosition != maRect.Right() )
    3599           0 :                     maRect.Right() = nPosition;
    3600           0 :             }
    3601             : 
    3602           0 :             nPosition = aPosition.Y;
    3603           0 :             for ( sal_Int32 y = 0; y < nRowCount; y++ )
    3604             :             {
    3605           0 :                 uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW );
    3606           0 :                 awt::Size aS( 0, 0 );
    3607           0 :                 xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
    3608           0 :                 awt::Size aM( MapSize( aS ) );
    3609           0 :                 aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) );
    3610           0 :                 nPosition += aM.Height;
    3611           0 :                 if ( y == nRowCount - 1 && nPosition != maRect.Bottom())
    3612           0 :                     maRect.Bottom() = nPosition;
    3613           0 :             }
    3614           0 :             mpPptEscherEx->OpenContainer( ESCHER_SpgrContainer );
    3615           0 :             mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    3616           0 :             mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 );
    3617           0 :             mpStrm    ->WriteInt32( (sal_Int32)maRect.Left() ) // Bounding box for the grouped shapes to which they are attached
    3618           0 :                        .WriteInt32( (sal_Int32)maRect.Top() )
    3619           0 :                        .WriteInt32( (sal_Int32)maRect.Right() )
    3620           0 :                        .WriteInt32( (sal_Int32)maRect.Bottom() );
    3621             : 
    3622           0 :             sal_uInt32 nShapeId = mpPptEscherEx->GenerateShapeId();
    3623           0 :             mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId );     // Flags: Group | Patriarch
    3624           0 :             aSolverContainer.AddShape( rXShape, nShapeId );
    3625           0 :             EscherPropertyContainer aPropOpt2;
    3626             : 
    3627           0 :             if ( nRowCount )
    3628             :             {
    3629           0 :                 SvMemoryStream aMemStrm;
    3630           0 :                 aMemStrm.ObjectOwnsMemory( false );
    3631           0 :                 aMemStrm.WriteUInt16( nRowCount )
    3632           0 :                         .WriteUInt16( nRowCount )
    3633           0 :                         .WriteUInt16( (sal_uInt16)4 );
    3634             : 
    3635           0 :                 std::vector< std::pair< sal_Int32, sal_Int32 > >::const_iterator aIter( aRows.begin() );
    3636           0 :                 while( aIter != aRows.end() )
    3637           0 :                     aMemStrm.WriteInt32( (*aIter++).second );
    3638             : 
    3639           0 :                 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x1000100 );
    3640           0 :                 aPropOpt2.AddOpt( ESCHER_Prop_tableProperties, 1 );
    3641           0 :                 aPropOpt2.AddOpt( ESCHER_Prop_tableRowProperties, true, aMemStrm.Tell(), static_cast< sal_uInt8* >( const_cast< void* >( aMemStrm.GetData() ) ), aMemStrm.Tell() );
    3642           0 :                 aPropOpt.CreateShapeProperties( rXShape );
    3643           0 :                 aPropOpt.Commit( *mpStrm );
    3644           0 :                 aPropOpt2.Commit( *mpStrm, 3, ESCHER_UDefProp );
    3645           0 :                 if ( GetCurrentGroupLevel() > 0 )
    3646           0 :                     mpPptEscherEx->AddChildAnchor( maRect );
    3647             :                 else
    3648           0 :                     mpPptEscherEx->AddClientAnchor( maRect );
    3649           0 :                 mpPptEscherEx->CloseContainer();
    3650             : 
    3651           0 :                 uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
    3652           0 :                 for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
    3653             :                 {
    3654           0 :                     for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
    3655             :                     {
    3656           0 :                         uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ), uno::UNO_QUERY_THROW );
    3657           0 :                         if ( !xCell->isMerged() )
    3658             :                         {
    3659           0 :                             sal_Int32 nLeft   = aColumns[ nColumn ].first;
    3660           0 :                             sal_Int32 nTop    = aRows[ nRow ].first;
    3661           0 :                             sal_Int32 nRight  = GetCellRight( nColumn, maRect,aColumns,xCell );
    3662           0 :                             sal_Int32 nBottom = GetCellBottom( nRow,  maRect,aRows,xCell );
    3663             : 
    3664           0 :                             mbFontIndependentLineSpacing = sal_False;
    3665           0 :                             mXPropSet = uno::Reference< beans::XPropertySet >( xCell, uno::UNO_QUERY_THROW );
    3666           0 :                             mXText = uno::Reference< text::XSimpleText >( xCell, uno::UNO_QUERY_THROW );
    3667           0 :                             mnTextSize = mXText->getString().getLength();
    3668             : 
    3669           0 :                             ::com::sun::star::uno::Any aAny;
    3670           0 :                             if ( GetPropertyValue( aAny, mXPropSet, OUString( "FontIndependentLineSpacing" ) ), sal_True )
    3671           0 :                                 aAny >>= mbFontIndependentLineSpacing;
    3672             : 
    3673           0 :                             EscherPropertyContainer aPropOptSp;
    3674           0 :                             mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
    3675           0 :                             ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa02, aSolverContainer );          // Flags: Connector | HasSpt | Child
    3676           0 :                             aPropOptSp.CreateFillProperties( mXPropSet, true );
    3677           0 :                             aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
    3678           0 :                             aPropOptSp.CreateTextProperties( mXPropSet, mnTxId += 0x60, false, true );
    3679           0 :                             aPropOptSp.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapSquare );
    3680             : 
    3681           0 :                             SvMemoryStream aClientTextBox( 0x200, 0x200 );
    3682           0 :                             SvMemoryStream  aExtBu( 0x200, 0x200 );
    3683             : 
    3684           0 :                             ImplWriteTextStyleAtom( aClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOptSp );
    3685             : 
    3686             :                             // need write client data for extend bullet
    3687           0 :                             if ( aExtBu.Tell() )
    3688             :                             {
    3689           0 :                                 SvMemoryStream* pClientData = new SvMemoryStream( 0x200, 0x200 );
    3690           0 :                                 ImplProgTagContainer( pClientData, &aExtBu );
    3691           0 :                                 mpStrm->WriteUInt32( (sal_uInt32)( ( ESCHER_ClientData << 16 ) | 0xf ) )
    3692           0 :                                    .WriteUInt32( (sal_uInt32)pClientData->Tell() );
    3693             : 
    3694           0 :                                 mpStrm->Write( pClientData->GetData(), pClientData->Tell() );
    3695           0 :                                 delete pClientData, pClientData = NULL;
    3696             :                             }
    3697             : 
    3698           0 :                             aPropOptSp.Commit( *mpStrm );
    3699           0 :                             mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
    3700           0 :                             mpStrm    ->WriteInt32( nLeft )
    3701           0 :                                .WriteInt32( nTop )
    3702           0 :                                .WriteInt32( nRight )
    3703           0 :                                .WriteInt32( nBottom );
    3704             : 
    3705           0 :                             mpStrm->WriteUInt32( (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf ) )
    3706           0 :                                .WriteUInt32( (sal_uInt32)aClientTextBox.Tell() );
    3707             : 
    3708           0 :                             mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
    3709           0 :                             mpPptEscherEx->CloseContainer();
    3710             :                         }
    3711           0 :                     }
    3712             :                 }
    3713             : 
    3714           0 :                 static const OUString sTopBorder( "TopBorder" );
    3715           0 :                 static const OUString sBottomBorder( "BottomBorder" );
    3716           0 :                 static const OUString sLeftBorder( "LeftBorder" );
    3717           0 :                 static const OUString sRightBorder( "RightBorder" );
    3718             : 
    3719             :                 // creating horz lines
    3720           0 :                 for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
    3721             :                 {
    3722           0 :                     for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
    3723             :                     {
    3724           0 :                         CellBorder aCellBorder;
    3725           0 :                         aCellBorder.mnPos = aColumns[ nColumn ].first;
    3726           0 :                         aCellBorder.mnLength = aColumns[ nColumn ].second;
    3727           0 :                         sal_Bool bTop = sal_False;
    3728             :                         //write nLine*nColumn cell's top border
    3729           0 :                         if ( nLine < xRows->getCount() )
    3730             :                         {   // top border
    3731           0 :                             uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
    3732           0 :                             if ( !xCell->isMerged()  )
    3733             :                             {
    3734           0 :                                 uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
    3735           0 :                                 table::BorderLine aBorderLine;
    3736           0 :                                 if ( xPropSet2->getPropertyValue( sTopBorder ) >>= aBorderLine )
    3737           0 :                                     aCellBorder.maCellBorder = aBorderLine;
    3738           0 :                                 sal_Int32 nRight  = GetCellRight( nColumn, maRect,aColumns,xCell );
    3739             :                                 bTop = ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos,
    3740           0 :                                     aRows[ nLine ].first, nRight,  aRows[ nLine ].first );
    3741           0 :                             }
    3742             :                         }
    3743             : 
    3744             :                         //if nLine*nColumn cell's top border is empty, check (nLine-1)*nColumn cell's bottom border
    3745             :                         //and write the last row's bottom border
    3746           0 :                         if (( nLine && !bTop ) || (nLine == xRows->getCount()))
    3747             :                         {   // bottom border
    3748           0 :                             sal_Int32 nRow =  nLine;
    3749             : 
    3750           0 :                             while( nRow )
    3751             :                             {   //find last no merged cell
    3752           0 :                                 uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow - 1 ), uno::UNO_QUERY_THROW );
    3753           0 :                                 if ( !xCell->isMerged()  )
    3754             :                                 {
    3755           0 :                                     sal_Int32 nRight  = GetCellRight( nColumn,  maRect,aColumns,xCell );
    3756           0 :                                     sal_Int32 nBottom = GetCellBottom( nRow - 1, maRect,aRows,xCell );
    3757           0 :                                     if ( nBottom == ( aRows[ nLine-1 ].first + aRows[ nLine-1 ].second ) )
    3758             :                                     {
    3759           0 :                                         uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn, nRow - 1 ), uno::UNO_QUERY_THROW );
    3760           0 :                                         uno::Reference< beans::XPropertySet > xPropSet2( xCellOwn, uno::UNO_QUERY_THROW );
    3761           0 :                                         table::BorderLine aBorderLine;
    3762           0 :                                         if ( xPropSet2->getPropertyValue( sBottomBorder ) >>= aBorderLine )
    3763           0 :                                             aCellBorder.maCellBorder = aBorderLine;
    3764             :                                         ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos,
    3765           0 :                                             nBottom, nRight, nBottom);
    3766             :                                     }
    3767           0 :                                     nRow=0;
    3768             :                                 }
    3769             :                                 else
    3770           0 :                                     nRow--;
    3771           0 :                             }
    3772             :                         }
    3773             :                     }
    3774             :                 }
    3775             : 
    3776             :                 // creating vertical lines
    3777           0 :                 for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
    3778             :                 {
    3779           0 :                     for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
    3780             :                     {
    3781             : 
    3782           0 :                         CellBorder aCellBorder;
    3783           0 :                         aCellBorder.mnPos = aRows[ nRow].first;
    3784           0 :                         aCellBorder.mnLength = aRows[ nRow].second;
    3785           0 :                         sal_Bool bLeft = sal_False;
    3786           0 :                         if ( nLine < xColumns->getCount() )
    3787             :                         {   // left border
    3788           0 :                             uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
    3789           0 :                             if (!xCell->isMerged() )
    3790             :                             {
    3791           0 :                                 uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
    3792           0 :                                 table::BorderLine aBorderLine;
    3793           0 :                                 if ( xCellSet->getPropertyValue( sLeftBorder ) >>= aBorderLine )
    3794           0 :                                     aCellBorder.maCellBorder = aBorderLine;
    3795           0 :                                 sal_Int32 nBottom = GetCellBottom( nRow, maRect, aRows,xCell );
    3796           0 :                                 bLeft = ImplCreateCellBorder( &aCellBorder, aColumns[nLine].first, aCellBorder.mnPos,
    3797           0 :                                     aColumns[nLine].first, nBottom );
    3798           0 :                             }
    3799             :                         }
    3800           0 :                         if ( ( nLine && !bLeft )||(nLine == xColumns->getCount()))
    3801             :                         {   // right border
    3802           0 :                             sal_Int32 nColumn = nLine;
    3803           0 :                             while ( nColumn )
    3804             :                             {
    3805           0 :                                 uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn - 1, nRow ), uno::UNO_QUERY_THROW );
    3806           0 :                                 if (!xCell->isMerged() )
    3807             :                                 {
    3808           0 :                                     sal_Int32 nRight  = GetCellRight( nColumn-1, maRect, aColumns,xCell );
    3809           0 :                                     sal_Int32 nBottom = GetCellBottom( nRow,   maRect, aRows, xCell );
    3810           0 :                                     if ( nRight == (aColumns[nLine-1].first + aColumns[nLine-1].second) )
    3811             :                                     {
    3812           0 :                                         uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn - 1, nRow ), uno::UNO_QUERY_THROW );
    3813           0 :                                         uno::Reference< beans::XPropertySet > xCellSet( xCellOwn, uno::UNO_QUERY_THROW );
    3814           0 :                                         table::BorderLine aBorderLine;
    3815           0 :                                         if ( xCellSet->getPropertyValue( sRightBorder ) >>= aBorderLine )
    3816           0 :                                             aCellBorder.maCellBorder = aBorderLine;
    3817             :                                         ImplCreateCellBorder( &aCellBorder, nRight, aCellBorder.mnPos,
    3818           0 :                                             nRight,  nBottom );
    3819             :                                     }
    3820           0 :                                     nColumn = 0;
    3821             :                                 }
    3822             :                                 else
    3823           0 :                                     nColumn --;
    3824           0 :                             }
    3825             :                         }
    3826             :                     }
    3827           0 :                 }
    3828           0 :             }
    3829           0 :         }
    3830             :     }
    3831           0 :     catch( uno::Exception& )
    3832             :     {
    3833             :     }
    3834           0 :     mpPptEscherEx->CloseContainer();
    3835           0 : }
    3836             : 
    3837           0 : void TextObjBinary::Write( SvStream* pStrm )
    3838             : {
    3839           0 :     sal_uInt32 nSize, nPos = pStrm->Tell();
    3840           0 :     pStrm->WriteUInt32( (sal_uInt32)( EPP_TextCharsAtom << 16 ) ).WriteUInt32( (sal_uInt32)0 );
    3841           0 :     for ( sal_uInt32 i = 0; i < ParagraphCount(); ++i )
    3842           0 :         GetParagraph(i)->Write( pStrm );
    3843           0 :     nSize = pStrm->Tell() - nPos;
    3844           0 :     pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
    3845           0 :     pStrm->WriteUInt32( (sal_uInt32)( nSize - 8 ) );
    3846           0 :     pStrm->SeekRel( nSize - 8 );
    3847           0 : }
    3848             : 
    3849           0 : void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm )
    3850             : {
    3851           0 :     sal_uInt32 nCharactersLeft( Count() );
    3852           0 :     if ( nCharactersLeft >= 1 )
    3853             :     {
    3854           0 :         EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 );
    3855           0 :         for ( sal_uInt32 i = 0; nCharactersLeft && i < ParagraphCount(); ++i )
    3856             :         {
    3857           0 :             ParagraphObj* pPtr = GetParagraph(i);
    3858           0 :             for ( ParagraphObj::const_iterator it = pPtr->begin(); nCharactersLeft && it != pPtr->end(); ++it )
    3859             :             {
    3860           0 :                 PortionObj* pPortion = *it;
    3861           0 :                 sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize;
    3862           0 :                 sal_Int32 nFlags = 7;
    3863           0 :                 nCharactersLeft -= nPortionSize;
    3864           0 :                 pStrm ->WriteUInt32( static_cast< sal_uInt32 >( nPortionSize ) )
    3865           0 :                        .WriteInt32( nFlags )
    3866           0 :                        .WriteInt16( static_cast< sal_Int16 >( 1 ) )    // spellinfo -> needs rechecking
    3867           0 :                        .WriteInt16( static_cast< sal_Int16 >( LanguageTag( pPortion->meCharLocale ).makeFallback().getLanguageType() ) )
    3868           0 :                        .WriteInt16( static_cast< sal_Int16 >( 0 ) );   // alt language
    3869             :             }
    3870             :         }
    3871           0 :         if ( nCharactersLeft )
    3872           0 :             pStrm->WriteUInt32( nCharactersLeft ).WriteInt32( static_cast< sal_Int32 >( 1 ) ).WriteInt16( static_cast< sal_Int16 >( 1 ) );
    3873             : 
    3874             :     }
    3875           0 : }
    3876             : 
    3877             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10