LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/filter/eppt - epptso.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 2374 0.1 %
Date: 2013-07-09 Functions: 2 41 4.9 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10