diff options
author | Tor Lillqvist <tlillqvist@novell.com> | 2010-11-01 16:13:58 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@hemulen.(none)> | 2010-11-05 23:52:16 +0200 |
commit | 0494b4df6106f378aa3936843c64a7d10d7759fc (patch) | |
tree | 1bceeadfc6008883ea2adcb59eecd5430185f623 | |
parent | ba5b9d706f16ca781f2783959e06abb819880cd8 (diff) |
From hg changeset 11bdb9c019c49df77306d1a9915b44e1f8dbf79e in ooxml11
ooxml11: intermediate commit
-rw-r--r-- | sd/source/filter/eppt/eppt.cxx | 1636 | ||||
-rw-r--r-- | sd/source/filter/eppt/eppt.hxx | 498 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 2142 | ||||
-rw-r--r-- | sd/source/filter/eppt/makefile.mk | 11 |
4 files changed, 651 insertions, 3636 deletions
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index a9baccf9c..5f504929c 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -63,54 +63,22 @@ #include <filter/msfilter/svxmsbas.hxx> #include <editeng/flditem.hxx> #include <sfx2/docinf.hxx> +#include <oox/export/utils.hxx> using namespace com::sun::star; -static PHLayout pPHLayout[] = -{ - { EPP_LAYOUT_TITLESLIDE, { 0x0d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x10, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, TRUE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x14, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x15, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_RIGHTCOLUMN2ROWS, { 0x0d, 0x0e, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_LEFTCOLUMN2ROWS, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TOPROW2COLUMN, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_4OBJECTS, { 0x0d, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_ONLYTITLE, { 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE }, - { EPP_LAYOUT_TITLERIGHT2BODIESLEFT, { 0x11, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x11, 0x12, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLERIGHTBODYLEFT, { 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x11, 0x12, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x12, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x12, TRUE, TRUE, FALSE } -}; - //============================ PPTWriter ================================== PPTWriter::PPTWriter( SvStorageRef& rSvStorage, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel, ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd, SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) : + PPTWriterBase ( rXModel, rXStatInd ), + mnCnvrtFlags ( nCnvrtFlags ), mbStatus ( sal_False ), - mbUseNewAnimations ( sal_True ), + mbUseNewAnimations ( sal_True ), mnLatestStatValue ( 0 ), - maFraction ( 1, 576 ), - maMapModeSrc ( MAP_100TH_MM ), - maMapModeDest ( MAP_INCH, Point(), maFraction, maFraction ), - meLatestPageType ( NORMAL ), - mXModel ( rXModel ), - mXStatusIndicator ( rXStatInd ), - mbStatusIndicator ( FALSE ), + mrStg ( rSvStorage ), mpCurUserStrm ( NULL ), mpStrm ( NULL ), mpPicStrm ( NULL ), @@ -122,38 +90,10 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, mnPagesWritten ( 0 ), mnTxId ( 0x7a2f64 ) { - sal_uInt32 i; - if ( !ImplInitSOIface() ) - return; - - FontCollectionEntry aDefaultFontDesc( String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ), - ::com::sun::star::awt::FontFamily::ROMAN, - ::com::sun::star::awt::FontPitch::VARIABLE, - RTL_TEXTENCODING_MS_1252 ); - maFontCollection.GetId( aDefaultFontDesc ); // default is always times new roman - - if ( !ImplGetPageByIndex( 0, NOTICE ) ) - return; - INT32 nWidth = 21000; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) ) - mAny >>= nWidth; - INT32 nHeight = 29700; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) ) - mAny >>= nHeight; - - maNotesPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) ); +} - if ( !ImplGetPageByIndex( 0, MASTER ) ) - return; - nWidth = 28000; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) ) - mAny >>= nWidth; - nHeight = 21000; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) ) - mAny >>= nHeight; - maDestPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) ); - - mrStg = rSvStorage; +void PPTWriter::exportPPTPre() +{ if ( !mrStg.Is() ) return; @@ -182,30 +122,10 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, mpPicStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) ); mpPptEscherEx = new PptEscherEx( *mpStrm ); +} - if ( !ImplGetStyleSheets() ) - return; - - if ( !ImplCreateDocument() ) - return; - - for ( i = 0; i < mnMasterPages; i++ ) - { - if ( !ImplCreateMaster( i ) ) - return; - } - if ( !ImplCreateMainNotes() ) - return; - for ( i = 0; i < mnPages; i++ ) - { - if ( !ImplCreateSlide( i ) ) - return; - } - for ( i = 0; i < mnPages; i++ ) - { - if ( !ImplCreateNotes( i ) ) - return; - } +void PPTWriter::exportPPTPost( ) +{ if ( !ImplCloseDocument() ) return; @@ -220,19 +140,369 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, } } - ImplWriteOLE( nCnvrtFlags ); + ImplWriteOLE(); ImplWriteVBA( pVBA ); if ( !ImplWriteAtomEnding() ) return; - if ( !ImplCreateDocumentSummaryInformation( nCnvrtFlags ) ) + if ( !ImplCreateDocumentSummaryInformation() ) return; mbStatus = TRUE; }; +// --------------------------------------------------------------------------------------------- + +void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode, + sal_Bool bHasBackground, Reference< XPropertySet > aXBackgroundPropSet ) +{ + Any aAny; + + const PHLayout& rLayout = GetLayout( mXPagePropSet ); + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() ); + mpPptEscherEx->OpenContainer( EPP_Slide ); + mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); + *mpStrm << rLayout.nLayout; + mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck ) + *mpStrm << (sal_uInt32)nMasterID // master ID ( ist gleich 0x80000000 bei einer masterpage ) + << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden ) + << nMode + << (sal_uInt16)0; // padword + + mnDiaMode = 0; + sal_Bool bVisible = sal_True; + ::com::sun::star::presentation::FadeEffect eFe = ::com::sun::star::presentation::FadeEffect_NONE; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ) ) ) + aAny >>= bVisible; + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) ) + { + switch ( *(INT32*)aAny.getValue() ) + { + case 1 : // automatisch + mnDiaMode++; + case 2 : // halbautomatisch + mnDiaMode++; + default : + case 0 : // manuell + break; + } + } + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) ) + aAny >>= eFe; + + sal_uInt32 nSoundRef = 0; + sal_Bool bIsSound = sal_False; + sal_Bool bStopSound = sal_False; + sal_Bool bLoopSound = sal_False; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) ) + { + rtl::OUString aSoundURL; + if ( aAny >>= aSoundURL ) + { + nSoundRef = maSoundCollection.GetId( aSoundURL ); + bIsSound = sal_True; + } + else + aAny >>= bStopSound; + } + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) ) + aAny >>= bLoopSound; + + sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == FALSE ) + || ( mnDiaMode == 2 ) + || ( bIsSound ) + || ( bStopSound ) + || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE ); + if ( bNeedsSSSlideInfoAtom ) + { + sal_uInt8 nDirection = 0; + sal_uInt8 nTransitionType = 0; + sal_uInt16 nBuildFlags = 1; // advange by mouseclick + INT32 nSlideTime = 0; // muss noch !!! + sal_uInt8 nSpeed = 1; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ) ) ) + { + ::com::sun::star::presentation::AnimationSpeed aAs; + aAny >>= aAs; + nSpeed = (sal_uInt8)aAs; + } + sal_Int16 nTT = 0, nTST = 0; + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) + && ( aAny >>= nTT ) ) + { + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) ) + && ( aAny >>= nTST ) ) + nTransitionType = GetTransition( nTT, nTST, eFe, nDirection ); + + } + if ( !nTransitionType ) + nTransitionType = GetTransition( eFe, nDirection ); + if ( mnDiaMode == 2 ) // automatic ? + nBuildFlags |= 0x400; + if ( bVisible == FALSE ) + nBuildFlags |= 4; + if ( bIsSound ) + nBuildFlags |= 16; + if ( bLoopSound ) + nBuildFlags |= 64; + if ( bStopSound ) + nBuildFlags |= 256; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Duration" ) ) ) )// duration of this slide + nSlideTime = *(INT32*)aAny.getValue() << 10; // in ticks + + mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom ); + *mpStrm << nSlideTime // standtime in ticks + << nSoundRef + << nDirection + << nTransitionType + << nBuildFlags + << nSpeed + << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0; + } + + ImplCreateHeaderFooters( mXPagePropSet ); + + EscherSolverContainer aSolverContainer; + mpPptEscherEx->OpenContainer( EPP_PPDrawing ); + mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); + mpPptEscherEx->EnterGroup(0,0); + ImplWritePage( rLayout, aSolverContainer, NORMAL, FALSE, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt + mpPptEscherEx->LeaveGroup(); + + if ( bHasBackground ) + ImplWriteBackground( aXBackgroundPropSet ); + else + { + mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt + EscherPropertyContainer aPropOpt; + aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) ); + aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) ); + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 ); + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 ); + aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow ); + aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape + aPropOpt.Commit( *mpStrm ); + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer + } + + aSolverContainer.WriteSolver( *mpStrm ); + + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer + mpPptEscherEx->CloseContainer(); // EPP_Drawing + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; + + SvMemoryStream aBinaryTagData10Atom; + ImplExportComments( mXDrawPage, aBinaryTagData10Atom ); + if ( mbUseNewAnimations ) + { + SvMemoryStream amsofbtAnimGroup; + ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection ); + aExporter.doexport( mXDrawPage, amsofbtAnimGroup ); + sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell(); + if ( nmsofbtAnimGroupSize ) + { + { + EscherExAtom aMagic2( aBinaryTagData10Atom, 0x2eeb ); + aBinaryTagData10Atom << (sal_uInt32)0x01c45df9 + << (sal_uInt32)0xe1471b30; + } + { + EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 ); + aBinaryTagData10Atom << (sal_uInt32)0; + } + aBinaryTagData10Atom.Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); + { + EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 ); + } + } + } + if ( aBinaryTagData10Atom.Tell() ) + { + EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags ); + EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag ); + { + EscherExAtom aCString( *mpStrm, EPP_CString ); + *mpStrm << (sal_uInt32)0x5f005f + << (sal_uInt32)0x50005f + << (sal_uInt32)0x540050 + << (sal_uInt16)0x31 + << (sal_uInt16)0x30; + } + { + EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); + mpStrm->Write( aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell() ); + } + } +/* + if ( mbUseNewAnimations ) + { + SvMemoryStream amsofbtAnimGroup; + ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection ); + aExporter.doexport( mXDrawPage, amsofbtAnimGroup ); + sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell(); + if ( nmsofbtAnimGroupSize ) + { + EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags ); + EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag ); + { + EscherExAtom aCString( *mpStrm, EPP_CString ); + *mpStrm << (sal_uInt32)0x5f005f + << (sal_uInt32)0x50005f + << (sal_uInt32)0x540050 + << (sal_uInt16)0x31 + << (sal_uInt16)0x30; + } + { + EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); + { + { + EscherExAtom aMagic2( *mpStrm, 0x2eeb ); + *mpStrm << (sal_uInt32)0x01c45df9 + << (sal_uInt32)0xe1471b30; + } + { + EscherExAtom aMagic( *mpStrm, 0x2b00 ); + *mpStrm << (sal_uInt32)0; + } + } + mpStrm->Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); + { + EscherExContainer aMagic2( *mpStrm, 0x2b02 ); + } + } + } + } +*/ + mpPptEscherEx->CloseContainer(); // EPP_Slide +} + +// --------------------------------------------------------------------------------------------- + +void PPTWriter::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > aXBackgroundPropSet ) +{ + sal_uInt32 nFillColor = 0xffffff; + sal_uInt32 nFillBackColor = 0x000000; + + ::com::sun::star::drawing::FillStyle aFS = ::com::sun::star::drawing::FillStyle_NONE; + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) ) + mAny >>= aFS; + switch ( aFS ) + { + case ::com::sun::star::drawing::FillStyle_GRADIENT : + { + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ) ) ) + { + nFillColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 0 ); + nFillBackColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 1 ); + } + } + break; + + case ::com::sun::star::drawing::FillStyle_SOLID : + { + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) ) + { + nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ); + nFillBackColor = nFillColor ^ 0xffffff; + } + } + break; + + default: + break; + } + + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() ); + mpPptEscherEx->OpenContainer( EPP_MainMaster ); + mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); + *mpStrm << (INT32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide + << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID + << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage ) + << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden ) + << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background + << (sal_uInt16)0; // padword + + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff << (sal_uInt32)0x969696; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 << (sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 << (sal_uInt32)0x66ccff; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 << (sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d << (sal_uInt32)0xeaeaea; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xc0c0c0; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff << (sal_uInt32)0x009900; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xb2b2b2; + + for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) + { + if ( nInstance == EPP_TEXTTYPE_notUsed ) + continue; + + // the auto color is dependent to the page background,so we have to set a page that is in the right context + if ( nInstance == EPP_TEXTTYPE_Notes ) + ImplGetPageByIndex( 0, NOTICE ); + else + ImplGetPageByIndex( 0, MASTER ); + + mpPptEscherEx->BeginAtom(); + + sal_Bool bFirst = TRUE; + sal_Bool bSimpleText = FALSE; + + *mpStrm << (sal_uInt16)5; // paragraph count + + for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ ) + { + if ( nInstance >= EPP_TEXTTYPE_CenterBody ) + { + bFirst = FALSE; + bSimpleText = TRUE; + *mpStrm << nLev; + } + mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); + mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); + bFirst = FALSE; + } + mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance ); + } + ImplGetPageByIndex( nPageNum, MASTER ); + + EscherSolverContainer aSolverContainer; + + mpPptEscherEx->OpenContainer( EPP_PPDrawing ); + mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); + + mpPptEscherEx->EnterGroup(0,0); + ImplWritePage( GetLayout( 0 ), aSolverContainer, MASTER, TRUE ); // Die Shapes der Seite werden im PPT Dok. erzeugt + mpPptEscherEx->LeaveGroup(); + + ImplWriteBackground( aXBackgroundPropSet ); + + aSolverContainer.WriteSolver( *mpStrm ); + + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer + mpPptEscherEx->CloseContainer(); // EPP_Drawing + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; + + if ( aBuExMasterStream.Tell() ) + { + ImplProgTagContainer( mpStrm, &aBuExMasterStream ); + } + mpPptEscherEx->CloseContainer(); // EPP_MainMaster +}; // --------------------------------------------------------------------------------------------- @@ -259,13 +529,6 @@ PPTWriter::~PPTWriter() // --------------------------------------------------------------------------------------------- -static inline sal_uInt32 PPTtoEMU( INT32 nPPT ) -{ - return (sal_uInt32)( (double)nPPT * 1587.5 ); -} - -// --------------------------------------------------------------------------------------------- - sal_Bool PPTWriter::ImplCreateCurrentUserStream() { mpCurUserStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) ) ); @@ -298,7 +561,7 @@ sal_Bool PPTWriter::ImplCreateCurrentUserStream() // --------------------------------------------------------------------------------------------- -sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags ) +sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation() { uno::Reference<document::XDocumentPropertiesSupplier> xDPS( mXModel, uno::UNO_QUERY_THROW); @@ -328,7 +591,7 @@ sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags aHyperSeq[j] = pBlob[j]; } - if ( nCnvrtFlags & 0x8000 ) + if ( mnCnvrtFlags & 0x8000 ) { uno::Sequence<sal_uInt8> aThumbSeq; if ( ImplGetPageByIndex( 0, NORMAL ) && @@ -515,13 +778,13 @@ sal_Bool PPTWriter::ImplCreateDocument() mpPptEscherEx->PtInsert( EPP_Persist_Document, mpStrm->Tell() ); - mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default) + mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default) mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom ); *mpStrm << (sal_uInt32)0x25000d; if ( ImplGetPageByIndex( 0, MASTER ) ) ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet ); mpPptEscherEx->CloseContainer(); - mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default) + mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default) mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom ); *mpStrm << (sal_uInt32)0x3d000d; if ( ImplGetPageByIndex( 0, NOTICE ) ) @@ -534,7 +797,7 @@ sal_Bool PPTWriter::ImplCreateDocument() { mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom ); mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() ); - *mpStrm << (sal_uInt32)0 // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY ) + *mpStrm << (sal_uInt32)0 // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY ) << (sal_uInt32)4 // flags - only bit 3 used, if set then slide contains shapes other than placeholders << (INT32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects << (INT32)i + 0x100 // slideId - Unique slide identifier, used for OLE link monikers for example @@ -854,184 +1117,10 @@ sal_Bool PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm ) return TRUE; } -PHLayout& PPTWriter::ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const -{ - ::com::sun::star::uno::Any aAny; - sal_Int16 nLayout = 20; - if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Layout" ) ) ), sal_True ) - aAny >>= nLayout; - - if ( ( nLayout >= 21 ) && ( nLayout <= 26 ) ) // NOTES _> HANDOUT6 - nLayout = 20; - if ( ( nLayout >= 27 ) && ( nLayout <= 30 ) ) // VERTICAL LAYOUT - nLayout -= 6; - else if ( nLayout > 30 ) - nLayout = 20; - return pPHLayout[ nLayout ]; -} - - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplCreateMaster( sal_uInt32 nPageNum ) -{ - if ( !ImplGetPageByIndex( nPageNum, MASTER ) ) - return FALSE; - ImplSetCurrentStyleSheet( nPageNum ); - - if ( !ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ) ) // Backgroundshape laden - return FALSE; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet; - if ( !( mAny >>= aXBackgroundPropSet ) ) - return FALSE; - - sal_uInt32 nFillColor = 0xffffff; - sal_uInt32 nFillBackColor = 0x000000; - - ::com::sun::star::drawing::FillStyle aFS = ::com::sun::star::drawing::FillStyle_NONE; - if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) ) - mAny >>= aFS; - switch ( aFS ) - { - case ::com::sun::star::drawing::FillStyle_GRADIENT : - { - if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ) ) ) - { - nFillColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 0 ); - nFillBackColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 1 ); - } - } - break; - - case ::com::sun::star::drawing::FillStyle_SOLID : - { - if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) ) - { - nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ); - nFillBackColor = nFillColor ^ 0xffffff; - } - } - break; - - default: - break; - } - - mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() ); - mpPptEscherEx->OpenContainer( EPP_MainMaster ); - mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); - *mpStrm << (INT32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide - << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID - << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage ) - << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden ) - << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background - << (sal_uInt16)0; // padword - - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff << (sal_uInt32)0x969696; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 << (sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 << (sal_uInt32)0x66ccff; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 << (sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d << (sal_uInt32)0xeaeaea; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xc0c0c0; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff << (sal_uInt32)0x009900; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xb2b2b2; - - for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - if ( nInstance == EPP_TEXTTYPE_notUsed ) - continue; - - // the auto color is dependent to the page background,so we have to set a page that is in the right context - if ( nInstance == EPP_TEXTTYPE_Notes ) - ImplGetPageByIndex( 0, NOTICE ); - else - ImplGetPageByIndex( 0, MASTER ); - - mpPptEscherEx->BeginAtom(); - - sal_Bool bFirst = TRUE; - sal_Bool bSimpleText = FALSE; - - *mpStrm << (sal_uInt16)5; // paragraph count - - for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ ) - { - if ( nInstance >= EPP_TEXTTYPE_CenterBody ) - { - bFirst = FALSE; - bSimpleText = TRUE; - *mpStrm << nLev; - } - mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); - mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); - bFirst = FALSE; - } - mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance ); - } - ImplGetPageByIndex( nPageNum, MASTER ); - - EscherSolverContainer aSolverContainer; - - mpPptEscherEx->OpenContainer( EPP_PPDrawing ); - mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); - - mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( pPHLayout[ 0 ], aSolverContainer, MASTER, TRUE ); // Die Shapes der Seite werden im PPT Dok. erzeugt - mpPptEscherEx->LeaveGroup(); - - ImplWriteBackground( aXBackgroundPropSet ); - - aSolverContainer.WriteSolver( *mpStrm ); - - mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer - mpPptEscherEx->CloseContainer(); // EPP_Drawing - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; - - if ( aBuExMasterStream.Tell() ) - { - ImplProgTagContainer( mpStrm, &aBuExMasterStream ); - } - mpPptEscherEx->CloseContainer(); // EPP_MainMaster - return TRUE; -}; - // --------------------------------------------------------------------------------------------- sal_Bool PPTWriter::ImplCreateMainNotes() { - if ( !ImplGetPageByIndex( 0, NOTICE ) ) - return FALSE; - ImplSetCurrentStyleSheet( 0 ); - - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget > - aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( !aXMasterPageTarget.is() ) - return FALSE; - - mXDrawPage = aXMasterPageTarget->getMasterPage(); - if ( !mXDrawPage.is() ) - return FALSE; - - mXPropSet = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXPropSet.is() ) - return FALSE; - - mXShapes = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShapes > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXShapes.is() ) - return FALSE; - EscherSolverContainer aSolverContainer; mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() ); @@ -1043,20 +1132,20 @@ sal_Bool PPTWriter::ImplCreateMainNotes() mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, TRUE ); + ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, TRUE ); mpPptEscherEx->LeaveGroup(); mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); EscherPropertyContainer aPropOpt; - aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color + aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 ); aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x68bdde ); aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x8b9f8e ); aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 ); aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0 ); aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow ); - aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape + aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape aPropOpt.Commit( *mpStrm ); mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer @@ -1090,7 +1179,7 @@ static rtl::OUString getInitials( const rtl::OUString& rName ) // take letter if( nLength ) { - sInitials += rtl::OUString( *pStr ); + sInitials += rtl::OUString( *pStr ); nLength--; pStr++; } @@ -1115,7 +1204,7 @@ void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStr while( xAnnotationEnumeration->hasMoreElements() ) { - EscherExContainer aComment10( rBinaryTagData10Atom, EPP_Comment10 ); + EscherExContainer aComment10( rBinaryTagData10Atom, EPP_Comment10 ); { uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() ); @@ -1141,7 +1230,7 @@ void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStr rBinaryTagData10Atom << nIndex++ << aDateTime.Year << aDateTime.Month - << aDateTime.Day // todo: day of week + << aDateTime.Day // todo: day of week << aDateTime.Day << aDateTime.Hours << aDateTime.Minutes @@ -1159,462 +1248,8 @@ void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStr // --------------------------------------------------------------------------------------------- -sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum ) -{ - ::com::sun::star::uno::Any aAny; - - if ( !ImplGetPageByIndex( nPageNum, NORMAL ) ) - return FALSE; - sal_uInt32 nMasterID = ImplGetMasterIndex( NORMAL ); - ImplSetCurrentStyleSheet( nMasterID ); - nMasterID |= 0x80000000; - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet; - sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ); - if ( bHasBackground ) - bHasBackground = ( aAny >>= aXBackgroundPropSet ); - - sal_uInt16 nMode = 7; // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background - if ( bHasBackground ) - nMode &=~4; - -/* sj: Don't know what's IsBackgroundVisible for, have to ask cl - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundVisible" ) ) ) ) - { - sal_Bool bBackgroundVisible; - if ( aAny >>= bBackgroundVisible ) - { - if ( bBackgroundVisible ) - nMode &= ~4; - } - } -*/ - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) ) ) ) - { - sal_Bool bBackgroundObjectsVisible = sal_False; - if ( aAny >>= bBackgroundObjectsVisible ) - { - if ( !bBackgroundObjectsVisible ) - nMode &= ~1; - } - } - - const PHLayout& rLayout = ImplGetLayout( mXPagePropSet ); - mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() ); - mpPptEscherEx->OpenContainer( EPP_Slide ); - mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); - *mpStrm << rLayout.nLayout; - mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck ) - *mpStrm << (sal_uInt32)nMasterID // master ID ( ist gleich 0x80000000 bei einer masterpage ) - << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden ) - << nMode - << (sal_uInt16)0; // padword - - mnDiaMode = 0; - sal_Bool bVisible = sal_True; - ::com::sun::star::presentation::FadeEffect eFe = ::com::sun::star::presentation::FadeEffect_NONE; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ) ) ) - aAny >>= bVisible; - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) ) - { - switch ( *(INT32*)aAny.getValue() ) - { - case 1 : // automatisch - mnDiaMode++; - case 2 : // halbautomatisch - mnDiaMode++; - default : - case 0 : // manuell - break; - } - } - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) ) - aAny >>= eFe; - - sal_uInt32 nSoundRef = 0; - sal_Bool bIsSound = sal_False; - sal_Bool bStopSound = sal_False; - sal_Bool bLoopSound = sal_False; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) ) - { - rtl::OUString aSoundURL; - if ( aAny >>= aSoundURL ) - { - nSoundRef = maSoundCollection.GetId( aSoundURL ); - bIsSound = sal_True; - } - else - aAny >>= bStopSound; - } - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) ) - aAny >>= bLoopSound; - - - sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == FALSE ) - || ( mnDiaMode == 2 ) - || ( bIsSound ) - || ( bStopSound ) - || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE ); - if ( bNeedsSSSlideInfoAtom ) - { - sal_uInt8 nDirection = 0; - sal_uInt8 nTransitionType = 0; - sal_uInt16 nBuildFlags = 1; // advange by mouseclick - INT32 nSlideTime = 0; // muss noch !!! - sal_uInt8 nSpeed = 1; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ) ) ) - { - ::com::sun::star::presentation::AnimationSpeed aAs; - aAny >>= aAs; - nSpeed = (sal_uInt8)aAs; - } - sal_Int16 nTT = 0, nTST = 0; - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) - && ( aAny >>= nTT ) ) - { - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) ) - && ( aAny >>= nTST ) ) - { - switch( nTT ) - { - case animations::TransitionType::FADE : - { - if ( nTST == animations::TransitionSubType::CROSSFADE ) - nTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE; - else if ( nTST == animations::TransitionSubType::FADEOVERCOLOR ) - nTransitionType = PPT_TRANSITION_TYPE_FADE; - } - break; - case PPT_TRANSITION_TYPE_COMB : - { - nTransitionType = PPT_TRANSITION_TYPE_COMB; - if ( nTST == animations::TransitionSubType::COMBVERTICAL ) - nDirection++; - } - break; - case animations::TransitionType::PUSHWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_PUSH; - switch( nTST ) - { - case animations::TransitionSubType::FROMRIGHT: nDirection = 0; break; - case animations::TransitionSubType::FROMBOTTOM: nDirection = 1; break; - case animations::TransitionSubType::FROMLEFT: nDirection = 2; break; - case animations::TransitionSubType::FROMTOP: nDirection = 3; break; - } - } - break; - case animations::TransitionType::PINWHEELWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_WHEEL; - switch( nTST ) - { - case animations::TransitionSubType::ONEBLADE: nDirection = 1; break; - case animations::TransitionSubType::TWOBLADEVERTICAL : nDirection = 2; break; - case animations::TransitionSubType::THREEBLADE : nDirection = 3; break; - case animations::TransitionSubType::FOURBLADE: nDirection = 4; break; - case animations::TransitionSubType::EIGHTBLADE: nDirection = 8; break; - } - } - break; - case animations::TransitionType::FANWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_WEDGE; - } - break; - case animations::TransitionType::ELLIPSEWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_CIRCLE; - } - break; - case animations::TransitionType::FOURBOXWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_PLUS; - } - break; - case animations::TransitionType::IRISWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_DIAMOND; - } - break; - } - } - } - if ( !nTransitionType ) - { - switch ( eFe ) - { - default : - case ::com::sun::star::presentation::FadeEffect_RANDOM : - nTransitionType = PPT_TRANSITION_TYPE_RANDOM; - break; - - case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES : - nTransitionType = PPT_TRANSITION_TYPE_BLINDS; - break; - - case ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD : - nTransitionType = PPT_TRANSITION_TYPE_CHECKER; - break; - - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT : - nTransitionType = PPT_TRANSITION_TYPE_COVER; - break; - - case ::com::sun::star::presentation::FadeEffect_DISSOLVE : - nTransitionType = PPT_TRANSITION_TYPE_DISSOLVE; - break; - - case ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES : - nTransitionType = PPT_TRANSITION_TYPE_RANDOM_BARS; - break; - - case ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL : - nTransitionType = PPT_TRANSITION_TYPE_SPLIT; - break; - - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT : - nDirection += 4; - nTransitionType = PPT_TRANSITION_TYPE_STRIPS; - break; - - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT : - nTransitionType = PPT_TRANSITION_TYPE_PULL; - break; - - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT : - nTransitionType = PPT_TRANSITION_TYPE_WIPE; - break; - - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_LEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_RIGHT : - nTransitionType = PPT_TRANSITION_TYPE_WIPE; - break; - - case ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER : - nTransitionType = PPT_TRANSITION_TYPE_ZOOM; - break; - - case ::com::sun::star::presentation::FadeEffect_NONE : - nDirection = 2; - break; - } - } - if ( mnDiaMode == 2 ) // automatic ? - nBuildFlags |= 0x400; - if ( bVisible == FALSE ) - nBuildFlags |= 4; - if ( bIsSound ) - nBuildFlags |= 16; - if ( bLoopSound ) - nBuildFlags |= 64; - if ( bStopSound ) - nBuildFlags |= 256; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Duration" ) ) ) )// duration of this slide - nSlideTime = *(INT32*)aAny.getValue() << 10; // in ticks - - - mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom ); - *mpStrm << nSlideTime // standtime in ticks - << nSoundRef - << nDirection - << nTransitionType - << nBuildFlags - << nSpeed - << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0; - } - - ImplCreateHeaderFooters( mXPagePropSet ); - - EscherSolverContainer aSolverContainer; - mpPptEscherEx->OpenContainer( EPP_PPDrawing ); - mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); - mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( rLayout, aSolverContainer, NORMAL, FALSE, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt - mpPptEscherEx->LeaveGroup(); - - if ( bHasBackground ) - ImplWriteBackground( aXBackgroundPropSet ); - else - { - mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); - mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt - EscherPropertyContainer aPropOpt; - aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) ); - aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) ); - aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 ); - aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 ); - aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow ); - aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape - aPropOpt.Commit( *mpStrm ); - mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer - } - - aSolverContainer.WriteSolver( *mpStrm ); - - mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer - mpPptEscherEx->CloseContainer(); // EPP_Drawing - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; - - SvMemoryStream aBinaryTagData10Atom; - ImplExportComments( mXDrawPage, aBinaryTagData10Atom ); - if ( mbUseNewAnimations ) - { - SvMemoryStream amsofbtAnimGroup; - ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection ); - aExporter.doexport( mXDrawPage, amsofbtAnimGroup ); - sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell(); - if ( nmsofbtAnimGroupSize ) - { - { - EscherExAtom aMagic2( aBinaryTagData10Atom, 0x2eeb ); - aBinaryTagData10Atom << (sal_uInt32)0x01c45df9 - << (sal_uInt32)0xe1471b30; - } - { - EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 ); - aBinaryTagData10Atom << (sal_uInt32)0; - } - aBinaryTagData10Atom.Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); - { - EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 ); - } - } - } - if ( aBinaryTagData10Atom.Tell() ) - { - EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags ); - EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag ); - { - EscherExAtom aCString( *mpStrm, EPP_CString ); - *mpStrm << (sal_uInt32)0x5f005f - << (sal_uInt32)0x50005f - << (sal_uInt32)0x540050 - << (sal_uInt16)0x31 - << (sal_uInt16)0x30; - } - { - EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); - mpStrm->Write( aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell() ); - } - } -/* - if ( mbUseNewAnimations ) - { - SvMemoryStream amsofbtAnimGroup; - ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection ); - aExporter.doexport( mXDrawPage, amsofbtAnimGroup ); - sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell(); - if ( nmsofbtAnimGroupSize ) - { - EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags ); - EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag ); - { - EscherExAtom aCString( *mpStrm, EPP_CString ); - *mpStrm << (sal_uInt32)0x5f005f - << (sal_uInt32)0x50005f - << (sal_uInt32)0x540050 - << (sal_uInt16)0x31 - << (sal_uInt16)0x30; - } - { - EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); - { - { - EscherExAtom aMagic2( *mpStrm, 0x2eeb ); - *mpStrm << (sal_uInt32)0x01c45df9 - << (sal_uInt32)0xe1471b30; - } - { - EscherExAtom aMagic( *mpStrm, 0x2b00 ); - *mpStrm << (sal_uInt32)0; - } - } - mpStrm->Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); - { - EscherExContainer aMagic2( *mpStrm, 0x2b02 ); - } - } - } - } -*/ - mpPptEscherEx->CloseContainer(); // EPP_Slide - return TRUE; -}; - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum ) +void PPTWriter::ImplWriteNotes( sal_uInt32 nPageNum ) { - if ( !ImplGetPageByIndex( nPageNum, NOTICE ) ) - return FALSE; - ImplSetCurrentStyleSheet( ImplGetMasterIndex( NORMAL ) ); - - mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() ); mpPptEscherEx->OpenContainer( EPP_Notes ); mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 ); @@ -1630,7 +1265,7 @@ sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum ) mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, FALSE ); // Die Shapes der Seite werden im PPT Dok. erzeugt + ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, FALSE ); // Die Shapes der Seite werden im PPT Dok. erzeugt mpPptEscherEx->LeaveGroup(); mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); @@ -1654,7 +1289,6 @@ sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum ) mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; mpPptEscherEx->CloseContainer(); // EPP_Notes - return TRUE; }; void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet ) @@ -1702,7 +1336,7 @@ void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::su nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ); nFillBackColor = nFillColor ^ 0xffffff; } - } // PASSTHROUGH INTENDED + } // PASSTHROUGH INTENDED case ::com::sun::star::drawing::FillStyle_NONE : default: aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 ); @@ -1719,18 +1353,18 @@ void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::su mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer } -void PPTWriter::ImplWriteVBA( SvMemoryStream* pVBA ) +void PPTWriter::ImplWriteVBA() { - if ( pVBA ) + if ( mpVBA ) { - pVBA->Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nLen = pVBA->Tell(); + mpVBA->Seek( STREAM_SEEK_TO_END ); + sal_uInt32 nLen = mpVBA->Tell(); if ( nLen > 8 ) { nLen -= 8; mnVBAOleOfs = mpStrm->Tell(); mpPptEscherEx->BeginAtom(); - mpStrm->Write( (sal_Int8*)pVBA->GetData() + 8, nLen ); + mpStrm->Write( (sal_Int8*)mpVBA->GetData() + 8, nLen ); mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 ); } } @@ -1738,11 +1372,11 @@ void PPTWriter::ImplWriteVBA( SvMemoryStream* pVBA ) // --------------------------------------------------------------------------------------------- -void PPTWriter::ImplWriteOLE( sal_uInt32 nCnvrtFlags ) +void PPTWriter::ImplWriteOLE( ) { PPTExOleObjEntry* pPtr; - SvxMSExportOLEObjects aOleExport( nCnvrtFlags ); + SvxMSExportOLEObjects aOleExport( mnCnvrtFlags ); for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr; pPtr = (PPTExOleObjEntry*)maExOleObj.Next() ) @@ -1770,14 +1404,14 @@ void PPTWriter::ImplWriteOLE( sal_uInt32 nCnvrtFlags ) // SJ: #99809# create a dummy content stream, the dummy content is necessary for ppt, but not for // doc files, so we can't share code. SotStorageStreamRef xStm = xCleanStorage->OpenSotStream( aPersistStream, STREAM_STD_READWRITE ); - *xStm << (sal_uInt32)0 // no ClipboardId - << (sal_uInt32)4 // no target device - << (sal_uInt32)1 // aspect ratio - << (sal_Int32)-1 // L-Index - << (sal_uInt32)0 // Advanced Flags - << (sal_uInt32)0 // compression - << (sal_uInt32)0 // Size - << (sal_uInt32)0 // " + *xStm << (sal_uInt32)0 // no ClipboardId + << (sal_uInt32)4 // no target device + << (sal_uInt32)1 // aspect ratio + << (sal_Int32)-1 // L-Index + << (sal_uInt32)0 // Advanced Flags + << (sal_uInt32)0 // compression + << (sal_uInt32)0 // Size + << (sal_uInt32)0 // " << (sal_uInt32)0; pStrm = xCleanStorage->CreateMemoryStream(); } @@ -1803,7 +1437,7 @@ void PPTWriter::ImplWriteOLE( sal_uInt32 nCnvrtFlags ) mpPptEscherEx->BeginAtom(); pStrm->Seek( STREAM_SEEK_TO_END ); sal_uInt32 npStrmSize = pStrm->Tell(); - *mpStrm << npStrmSize; // uncompressed size + *mpStrm << npStrmSize; // uncompressed size #ifdef DBG_EXTRACTOLEOBJECTS SvFileStream aOut( String::CreateFromAscii( "D:\\OUT.OLE" ), STREAM_TRUNC | STREAM_WRITE ); @@ -1833,7 +1467,6 @@ sal_Bool PPTWriter::ImplWriteAtomEnding() #define EPP_LastViewTypeOutlineView 2 #define EPP_LastViewTypeNotes 3 - sal_uInt32 i, nPos, nOfs, nPersistOfs = mpStrm->Tell(); sal_uInt32 nPersistEntrys = 0; *mpStrm << (sal_uInt32)0 << (sal_uInt32)0 << (sal_uInt32)0; // Record Header und ersten Eintrag ueberspringen @@ -1937,488 +1570,6 @@ sal_Bool PPTWriter::ImplWriteAtomEnding() return TRUE; } -// --------------------------------------------------------------------------------------------- - -PPTExCharSheet::PPTExCharSheet( int nInstance ) -{ - sal_uInt16 nFontHeight = 24; - - for ( int nDepth = 0; nDepth < 5; nDepth++ ) - { - PPTExCharLevel& rLev = maCharLevel[ nDepth ]; - switch ( nInstance ) - { - case EPP_TEXTTYPE_Title : - case EPP_TEXTTYPE_CenterTitle : - nFontHeight = 44; - break; - case EPP_TEXTTYPE_Body : - case EPP_TEXTTYPE_CenterBody : - case EPP_TEXTTYPE_HalfBody : - case EPP_TEXTTYPE_QuarterBody : - { - switch ( nDepth ) - { - case 0 : nFontHeight = 32; break; - case 1 : nFontHeight = 28; break; - case 2 : nFontHeight = 24; break; - default :nFontHeight = 20; break; - } - } - break; - case EPP_TEXTTYPE_Notes : - nFontHeight = 12; - break; - case EPP_TEXTTYPE_notUsed : - case EPP_TEXTTYPE_Other : - nFontHeight = 24; - break; - } - rLev.mnFlags = 0; - rLev.mnFont = 0; - rLev.mnAsianOrComplexFont = 0xffff; - rLev.mnFontHeight = nFontHeight; - rLev.mnFontColor = 0; - rLev.mnEscapement = 0; - } -} - - -void PPTExCharSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection, int nLevel ) -{ - PortionObj aPortionObj( rXPropSet, rFontCollection ); - - PPTExCharLevel& rLev = maCharLevel[ nLevel ]; - - if ( aPortionObj.meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnFontColor = aPortionObj.mnCharColor; - if ( aPortionObj.meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnEscapement = aPortionObj.mnCharEscapement; - if ( aPortionObj.meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnFontHeight = aPortionObj.mnCharHeight; - if ( aPortionObj.meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnFont = aPortionObj.mnFont; - if ( aPortionObj.meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnAsianOrComplexFont = aPortionObj.mnAsianOrComplexFont; - rLev.mnFlags = aPortionObj.mnCharAttr; -} - -void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet ) -{ - const PPTExCharLevel& rLev = maCharLevel[ nLev ]; - - sal_uInt32 nCharFlags = 0xefffff; - if ( bSimpleText ) - nCharFlags = 0x7ffff; - - rSt << nCharFlags - << rLev.mnFlags - << rLev.mnFont; - - sal_uInt32 nFontColor = rLev.mnFontColor; - if ( nFontColor == COL_AUTO ) - { - sal_Bool bIsDark = sal_False; - ::com::sun::star::uno::Any aAny; - if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) ) - aAny >>= bIsDark; - nFontColor = bIsDark ? 0xffffff : 0x000000; - } - nFontColor &= 0xffffff; - nFontColor |= 0xfe000000; - if ( bSimpleText ) - { - rSt << rLev.mnFontHeight - << nFontColor; - } - else - { - rSt << rLev.mnAsianOrComplexFont - << (sal_uInt16)0xffff // unbekannt - << (sal_uInt16)0xffff // unbekannt - << rLev.mnFontHeight - << nFontColor - << rLev.mnEscapement; - } -} - -PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ) : - rBuProv ( rProv ), - mnInstance ( nInstance ) -{ - sal_Bool bHasBullet = FALSE; - - sal_uInt16 nUpperDist = 0; - sal_uInt16 nBulletChar = 0x2022; - sal_uInt16 nBulletOfs = 0; - sal_uInt16 nTextOfs = 0; - - for ( int nDepth = 0; nDepth < 5; nDepth++ ) - { - PPTExParaLevel& rLev = maParaLevel[ nDepth ]; - switch ( nInstance ) - { - case EPP_TEXTTYPE_Title : - case EPP_TEXTTYPE_CenterTitle : - break; - case EPP_TEXTTYPE_Body : - case EPP_TEXTTYPE_CenterBody : - case EPP_TEXTTYPE_HalfBody : - case EPP_TEXTTYPE_QuarterBody : - { - bHasBullet = TRUE; - nUpperDist = 0x14; - } - break; - case EPP_TEXTTYPE_Notes : - nUpperDist = 0x1e; - break; - -// default : -// case EPP_TEXTTYPE_notUsed : -// case EPP_TEXTTYPE_Other : -// break; - } - switch ( nDepth ) - { - case 0 : - { - nBulletChar = 0x2022; - nBulletOfs = 0; - nTextOfs = ( bHasBullet ) ? 0xd8 : 0; - } - break; - case 1 : - { - nBulletChar = 0x2013; - nBulletOfs = 0x120; - nTextOfs = 0x1d4; - } - break; - case 2 : - { - nBulletChar = 0x2022; - nBulletOfs = 0x240; - nTextOfs = 0x2d0; - } - break; - case 3 : - { - nBulletChar = 0x2013; - nBulletOfs = 0x360; - nTextOfs = 0x3f0; - } - break; - case 4 : - { - nBulletChar = 0xbb; - nBulletOfs = 0x480; - nTextOfs = 0x510; - } - break; - } - rLev.mbIsBullet = bHasBullet; - rLev.mnBulletChar = nBulletChar; - rLev.mnBulletFont = 0; - rLev.mnBulletHeight = 100; - rLev.mnBulletColor = 0; - rLev.mnAdjust = 0; - rLev.mnLineFeed = 100; - rLev.mnLowerDist = 0; - rLev.mnUpperDist = nUpperDist; - rLev.mnTextOfs = nTextOfs; - rLev.mnBulletOfs = nBulletOfs; - rLev.mnDefaultTab = nDefaultTab; - rLev.mnAsianSettings = 2; - rLev.mnBiDi = 0; - - rLev.mbExtendedBulletsUsed = FALSE; - rLev.mnBulletId = 0xffff; - rLev.mnBulletStart = 0; - rLev.mnMappedNumType = 0; - rLev.mnNumberingType = 0; - } -} - -void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel ) -{ - ParagraphObj aParagraphObj( rXPropSet, rBuProv ); - aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight ); - PPTExParaLevel& rLev = maParaLevel[ nLevel ]; - - if ( aParagraphObj.meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnAdjust = aParagraphObj.mnTextAdjust; - if ( aParagraphObj.meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - { - sal_Int16 nLineSpacing = aParagraphObj.mnLineSpacing; - if ( nLineSpacing > 0 ) // if nLinespacing is < 0 the linespacing is an absolute spacing - { - sal_Bool bFixedLineSpacing = sal_False; - uno::Any aAny = rXPropSet->getPropertyValue( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "FontIndependentLineSpacing" ) ) ); - if( !(aAny >>= bFixedLineSpacing) || !bFixedLineSpacing ) - { - const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont ); - if ( pDesc ) - nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 ); - } - } - else - { - if ( rCharLevel.mnFontHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point - { - const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont ); - if ( pDesc ) - nLineSpacing = (sal_Int16)( (double)100.0 * pDesc->Scaling + 0.5 ); - else - nLineSpacing = 100; - } - else - nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 ); - } - rLev.mnLineFeed = nLineSpacing; - } - if ( aParagraphObj.meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnLowerDist = aParagraphObj.mnLineSpacingBottom; - if ( aParagraphObj.meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnUpperDist = aParagraphObj.mnLineSpacingTop; - if ( aParagraphObj.meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - { - rLev.mnAsianSettings &=~1; - if ( aParagraphObj.mbForbiddenRules ) - rLev.mnAsianSettings |= 1; - } - if ( aParagraphObj.meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - { - rLev.mnAsianSettings &=~4; - if ( aParagraphObj.mbParagraphPunctation ) - rLev.mnAsianSettings |= 4; - } - - if ( aParagraphObj.meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnBiDi = aParagraphObj.mnBiDi; - - rLev.mbIsBullet = aParagraphObj.mbIsBullet; //( ( aParagraphObj.nBulletFlags & 1 ) != 0 ); - - if ( !nLevel ) - { - if ( ( aParagraphObj.meBullet == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - && aParagraphObj.bExtendedParameters ) - { - for ( sal_Int16 i = 0; i < 5; i++ ) - { - PPTExParaLevel& rLevel = maParaLevel[ i ]; - if ( i ) - aParagraphObj.ImplGetNumberingLevel( rBuProv, i, FALSE ); -// rLevel.mbIsBullet = ( ( aParagraphObj.nBulletFlags & 1 ) != 0 ); - rLevel.mnTextOfs = aParagraphObj.nTextOfs; - rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs; - rLevel.mnBulletChar = aParagraphObj.cBulletId; - FontCollectionEntry aFontDescEntry( aParagraphObj.aFontDesc.Name, aParagraphObj.aFontDesc.Family, - aParagraphObj.aFontDesc.Pitch, aParagraphObj.aFontDesc.CharSet ); - rLevel.mnBulletFont = (sal_uInt16)rFontCollection.GetId( aFontDescEntry ); - rLevel.mnBulletHeight = aParagraphObj.nBulletRealSize; - rLevel.mnBulletColor = aParagraphObj.nBulletColor; - - rLevel.mbExtendedBulletsUsed = aParagraphObj.bExtendedBulletsUsed; - rLevel.mnBulletId = aParagraphObj.nBulletId; - rLevel.mnNumberingType = aParagraphObj.nNumberingType; - rLevel.mnBulletStart = aParagraphObj.nStartWith; - rLevel.mnMappedNumType = aParagraphObj.nMappedNumType; - } - } - } -} - -void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet ) -{ - const PPTExParaLevel& rLev = maParaLevel[ nLev ]; - - if ( maParaLevel[ 0 ].mbExtendedBulletsUsed || maParaLevel[ 1 ].mbExtendedBulletsUsed || - maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed || - maParaLevel[ 4 ].mbExtendedBulletsUsed ) - { - SvStream& rOut = rBuProv.aBuExMasterStream; - if ( !nLev ) - { - rOut << (sal_uInt32)( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) ) - << (sal_uInt32)( 5 * 16 + 2 ) - << (sal_uInt16)5; // depth - } - sal_uInt16 nBulletId = rLev.mnBulletId; - if ( rLev.mnNumberingType != SVX_NUM_BITMAP ) - nBulletId = 0xffff; - rOut << (sal_uInt32)0x03800000 - << (sal_uInt16)nBulletId - << (sal_uInt32)rLev.mnMappedNumType - << (sal_uInt16)rLev.mnBulletStart - << (sal_uInt32)0; - } - - sal_uInt32 nParaFlags = 0x3ffdff; - sal_uInt16 nBulletFlags = ( rLev.mbIsBullet ) ? 0xf : 0xe; - - if ( nLev ) - nParaFlags &= 0x207fff; - if ( bSimpleText ) - nParaFlags &= 0x7fff; - sal_uInt32 nBulletColor = rLev.mnBulletColor; - if ( nBulletColor == COL_AUTO ) - { - sal_Bool bIsDark = sal_False; - ::com::sun::star::uno::Any aAny; - if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) ) - aAny >>= bIsDark; - nBulletColor = bIsDark ? 0xffffff : 0x000000; - } - nBulletColor &= 0xffffff; - nBulletColor |= 0xfe000000; - rSt << nParaFlags - << nBulletFlags - << rLev.mnBulletChar - << rLev.mnBulletFont - << rLev.mnBulletHeight - << nBulletColor - << rLev.mnAdjust - << rLev.mnLineFeed - << rLev.mnUpperDist - << rLev.mnLowerDist - << rLev.mnTextOfs - << rLev.mnBulletOfs; - - if ( bSimpleText || nLev ) - { - if ( nParaFlags & 0x200000 ) - rSt << rLev.mnBiDi; - } - else - { - rSt << rLev.mnDefaultTab - << (sal_uInt16)0 - << (sal_uInt16)0 - << rLev.mnAsianSettings - << rLev.mnBiDi; - } -} - - -PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv ) -{ - for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, rBuProv ); - mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance ); - } -} - -PPTExStyleSheet::~PPTExStyleSheet() -{ - for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - if ( nInstance == EPP_TEXTTYPE_notUsed ) - continue; - - delete mpParaSheet[ nInstance ]; - delete mpCharSheet[ nInstance ]; - } -} - -void PPTExStyleSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection, int nInstance, int nLevel ) -{ - if ( nInstance == EPP_TEXTTYPE_notUsed ) - return; - mpCharSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel ); - mpParaSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel, mpCharSheet[ nInstance ]->maCharLevel[ nLevel ] ); -} - -sal_Bool PPTExStyleSheet::IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue ) -{ - const PPTExParaLevel& rPara = mpParaSheet[ nInstance ]->maParaLevel[ nLevel ]; - const PPTExCharLevel& rChar = mpCharSheet[ nInstance ]->maCharLevel[ nLevel ]; - - sal_uInt32 nFlag = 0; - - switch ( eAttr ) - { - case ParaAttr_BulletOn : return ( rPara.mbIsBullet ) ? ( nValue ) ? FALSE : TRUE : ( nValue ) ? TRUE : FALSE; - case ParaAttr_BuHardFont : - case ParaAttr_BulletFont : return ( rPara.mnBulletFont != nValue ); - case ParaAttr_BuHardColor : - case ParaAttr_BulletColor : return ( rPara.mnBulletColor != nValue ); - case ParaAttr_BuHardHeight : - case ParaAttr_BulletHeight : return ( rPara.mnBulletHeight != nValue ); - case ParaAttr_BulletChar : return ( rPara.mnBulletChar != nValue ); - case ParaAttr_Adjust : return ( rPara.mnAdjust != nValue ); - case ParaAttr_LineFeed : return ( rPara.mnLineFeed != nValue ); - case ParaAttr_UpperDist : return ( rPara.mnUpperDist != nValue ); - case ParaAttr_LowerDist : return ( rPara.mnLowerDist != nValue ); - case ParaAttr_TextOfs : return ( rPara.mnTextOfs != nValue ); - case ParaAttr_BulletOfs : return ( rPara.mnBulletOfs != nValue ); - case ParaAttr_DefaultTab : return ( rPara.mnDefaultTab != nValue ); - case ParaAttr_BiDi : return ( rPara.mnBiDi != nValue ); - case CharAttr_Bold : nFlag = 1; break; - case CharAttr_Italic : nFlag = 2; break; - case CharAttr_Underline : nFlag = 4; break; - case CharAttr_Shadow : nFlag = 16; break; - case CharAttr_Strikeout : nFlag = 256; break; - case CharAttr_Embossed : nFlag = 512; break; - case CharAttr_Font : return ( rChar.mnFont != nValue ); - case CharAttr_AsianOrComplexFont : return ( rChar.mnAsianOrComplexFont != nValue ); - case CharAttr_Symbol : return TRUE; - case CharAttr_FontHeight : return ( rChar.mnFontHeight != nValue ); - case CharAttr_FontColor : return ( rChar.mnFontColor != nValue ); - case CharAttr_Escapement : return ( rChar.mnEscapement != nValue ); - default: - break; - }; - if ( nFlag ) - { - if ( rChar.mnFlags & nFlag ) - return ( ( nValue & nFlag ) == 0 ); - else - return ( ( nValue & nFlag ) != 0 ); - } - return TRUE; -} - -sal_uInt32 PPTExStyleSheet::SizeOfTxCFStyleAtom() const -{ - return 24; -} - -// the TxCFStyleAtom stores the text properties that are used -// when creating new objects in PowerPoint. - -void PPTExStyleSheet::WriteTxCFStyleAtom( SvStream& rSt ) -{ - const PPTExCharLevel& rCharStyle = mpCharSheet[ EPP_TEXTTYPE_Other ]->maCharLevel[ 0 ]; - - sal_uInt16 nFlags = 0x60 // ?? - | 0x02 // fontsize; - | 0x04; // fontcolor - - sal_uInt32 nCharFlags = rCharStyle.mnFlags; - nCharFlags &= CharAttr_Italic | CharAttr_Bold | CharAttr_Underline | CharAttr_Shadow; - - rSt << (sal_uInt32)( EPP_TxCFStyleAtom << 16 ) // recordheader - << SizeOfTxCFStyleAtom() - 8 - << (sal_uInt16)( 0x80 | nCharFlags ) - << (sal_uInt16)nFlags - << (sal_uInt16)nCharFlags - << (sal_Int32)-1 // ? - << rCharStyle.mnFontHeight - << rCharStyle.mnFontColor; -} - - -// --------------------------------------------------------------------------------------------- - // --------------------- // - exported function - // --------------------- @@ -2434,6 +1585,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT BOOL __LOADONCALLAPI ExportPPT( SvStorageRef& rS pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags ); if ( pPPTWriter ) { + pPPTWriter->exportPPT(); bStatus = ( pPPTWriter->IsValid() == TRUE ); delete pPPTWriter; } diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx index 59395bea2..11cd4f714 100644 --- a/sd/source/filter/eppt/eppt.hxx +++ b/sd/source/filter/eppt/eppt.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,6 +39,8 @@ #include "pptexanimations.hxx" #include <pptexsoundcollection.hxx> +#include "text.hxx" + // ------------------------------------------------------------------------ #include <vcl/mapmod.hxx> @@ -93,100 +95,61 @@ #include <epptbase.hxx> -#define EPP_MAINMASTER_PERSIST_KEY 0x80010000 -#define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000 -#define EPP_MAINSLIDE_PERSIST_KEY 0x80030000 -#define EPP_MAINNOTES_PERSIST_KEY 0x80040000 - -#define EPP_Persist_Document 0x80080000 -#define EPP_Persist_MainMaster 0x80100000 -#define EPP_Persist_MainNotes 0x80200000 -#define EPP_Persist_Slide 0x80400000 -#define EPP_Persist_Notes 0x80800000 -#define EPP_Persist_CurrentPos 0x81000000 -#define EPP_Persist_VBAInfoAtom 0x84000000 -#define EPP_Persist_ExObj 0x88000000 - -#define EPP_TEXTSTYLE_NORMAL 0x00000001 -#define EPP_TEXTSTYLE_TITLE 0x00000010 -#define EPP_TEXTSTYLE_BODY 0x00000100 -#define EPP_TEXTSTYLE_TEXT 0x00001000 - -struct SOParagraph -{ - sal_Bool bExtendedParameters; - sal_uInt32 nParaFlags; - sal_Int16 nBulletFlags; - String sPrefix; - String sSuffix; - String sGraphicUrl; // String auf eine Graphic - Size aBuGraSize; - sal_uInt32 nNumberingType; // in wirlichkeit ist dies ein SvxEnum - sal_uInt32 nHorzAdjust; - sal_uInt32 nBulletColor; - sal_Int32 nBulletOfs; - sal_Int16 nStartWith; // Start der nummerierung - sal_Int16 nTextOfs; - sal_Int16 nBulletRealSize; // GroessenVerhaeltnis in Proz - sal_Int16 nDepth; // aktuelle tiefe - sal_Unicode cBulletId; // wenn Numbering Type == CharSpecial - ::com::sun::star::awt::FontDescriptor aFontDesc; - - sal_Bool bExtendedBulletsUsed; - sal_uInt16 nBulletId; - sal_uInt32 nMappedNumType; - sal_Bool bNumberingIsNumber; - - SOParagraph() - { - nDepth = 0; - bExtendedParameters = FALSE; - nParaFlags = 0; - nBulletFlags = 0; - nBulletOfs = 0; - nTextOfs = 0; - bExtendedBulletsUsed = FALSE; - nBulletId = 0xffff; - bNumberingIsNumber = sal_True; - }; -}; +#define EPP_MAINMASTER_PERSIST_KEY 0x80010000 +#define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000 +#define EPP_MAINSLIDE_PERSIST_KEY 0x80030000 +#define EPP_MAINNOTES_PERSIST_KEY 0x80040000 + +#define EPP_Persist_Document 0x80080000 +#define EPP_Persist_MainMaster 0x80100000 +#define EPP_Persist_MainNotes 0x80200000 +#define EPP_Persist_Slide 0x80400000 +#define EPP_Persist_Notes 0x80800000 +#define EPP_Persist_CurrentPos 0x81000000 +#define EPP_Persist_VBAInfoAtom 0x84000000 +#define EPP_Persist_ExObj 0x88000000 + +#define EPP_TEXTSTYLE_NORMAL 0x00000001 +#define EPP_TEXTSTYLE_TITLE 0x00000010 +#define EPP_TEXTSTYLE_BODY 0x00000100 +#define EPP_TEXTSTYLE_TEXT 0x00001000 struct EPPTHyperlink { - String aURL; - sal_uInt32 nType; // bit 0-7 : type ( 1: click action to a slide ) - // ( 2: hyperlink url ) + String aURL; + sal_uInt32 nType; // bit 0-7 : type ( 1: click action to a slide ) + // ( 2: hyperlink url ) // bit 8-23: index // bit 31 : hyperlink is attached to a shape EPPTHyperlink( const String rURL, sal_uInt32 nT ) : - aURL ( rURL ), - nType ( nT ){}; + aURL ( rURL ), + nType ( nT ){}; }; enum PPTExOleObjEntryType { - NORMAL_OLE_OBJECT, OCX_CONTROL + NORMAL_OLE_OBJECT, OCX_CONTROL }; struct PPTExOleObjEntry { - PPTExOleObjEntryType eType; - sal_uInt32 nOfsA; // offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation) - sal_uInt32 nOfsB; // offset to the EPP_ExOleObjStg + PPTExOleObjEntryType eType; + sal_uInt32 nOfsA; // offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation) + sal_uInt32 nOfsB; // offset to the EPP_ExOleObjStg - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xControlModel; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xControlModel; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape; PPTExOleObjEntry( PPTExOleObjEntryType eT, sal_uInt32 nOfs ) : - eType ( eT ), - nOfsA ( nOfs ) {}; + eType ( eT ), + nOfsA ( nOfs ) {}; }; struct TextRuleEntry { - int nPageNumber; - SvMemoryStream* pOut; + int nPageNumber; + SvMemoryStream* pOut; TextRuleEntry( int nPg ) : nPageNumber( nPg ), @@ -195,329 +158,134 @@ struct TextRuleEntry ~TextRuleEntry() { delete pOut; }; }; -class PropStateValue : public PropValue +class TextObjBinary : public TextObj { - protected : - - ::com::sun::star::beans::PropertyState ePropState; - ::com::sun::star::uno::Reference - < ::com::sun::star::beans::XPropertyState > mXPropState; - - sal_Bool ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState = TRUE ); - +public: + TextObjBinary( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & + rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ) : TextObj( rXText, nInstance, rFontCollection, rBuProv ) {} + void Write( SvStream* pStrm ); + void WriteTextSpecInfo( SvStream* pStrm ); }; // ------------------------------------------------------------------------ -struct FieldEntry; -class PortionObj : public PropStateValue -{ - - friend class ParagraphObj; - - protected : - - void ImplClear(); - void ImplConstruct( const PortionObj& rPortionObj ); - sal_uInt32 ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, String& rURL ); - sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ); - void ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue = FALSE ); - - public : - - ::com::sun::star::beans::PropertyState meCharColor; - ::com::sun::star::beans::PropertyState meCharHeight; - ::com::sun::star::beans::PropertyState meFontName; - ::com::sun::star::beans::PropertyState meAsianOrComplexFont; - ::com::sun::star::beans::PropertyState meCharEscapement; - ::com::sun::star::lang::Locale meCharLocale; - sal_uInt16 mnCharAttrHard; - - sal_uInt32 mnCharColor; - sal_uInt16 mnCharAttr; - sal_uInt16 mnCharHeight; - sal_uInt16 mnFont; - sal_uInt16 mnAsianOrComplexFont; - sal_Int16 mnCharEscapement; - - sal_uInt32 mnTextSize; - sal_Bool mbLastPortion; - - sal_uInt16* mpText; - FieldEntry* mpFieldEntry; - - PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef, - sal_Bool bLast, FontCollection& rFontCollection ); - PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, - FontCollection& rFontCollection ); - PortionObj( const PortionObj& rPortionObj ); - ~PortionObj(); - - void Write( SvStream* pStrm, sal_Bool bLast ); - sal_uInt32 Count() const { return mnTextSize; }; - - PortionObj& operator=( const PortionObj& rPortionObj ); -}; - -struct ParaFlags -{ - sal_Bool bFirstParagraph : 1; - sal_Bool bLastParagraph : 1; - - ParaFlags() { bFirstParagraph = TRUE; bLastParagraph = FALSE; }; -}; - -class ParagraphObj : public List, public PropStateValue, public SOParagraph -{ - friend class TextObj; - friend struct PPTExParaSheet; - - MapMode maMapModeSrc; - MapMode maMapModeDest; - - protected : - - void ImplConstruct( const ParagraphObj& rParagraphObj ); - void ImplClear(); - sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ); - void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = FALSE ); - void ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue = FALSE ); - - public : - - ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop; - - sal_uInt32 mnTextSize; - - sal_Bool mbIsBullet; - sal_Bool mbFirstParagraph; - sal_Bool mbLastParagraph; - - ::com::sun::star::beans::PropertyState meBullet; - ::com::sun::star::beans::PropertyState meTextAdjust; - ::com::sun::star::beans::PropertyState meLineSpacing; - ::com::sun::star::beans::PropertyState meLineSpacingTop; - ::com::sun::star::beans::PropertyState meLineSpacingBottom; - ::com::sun::star::beans::PropertyState meForbiddenRules; - ::com::sun::star::beans::PropertyState meParagraphPunctation; - ::com::sun::star::beans::PropertyState meBiDi; - - sal_uInt16 mnTextAdjust; - sal_Int16 mnLineSpacing; - sal_Bool mbFixedLineSpacing; - sal_Int16 mnLineSpacingTop; - sal_Int16 mnLineSpacingBottom; - sal_Bool mbForbiddenRules; - sal_Bool mbParagraphPunctation; - sal_uInt16 mnBiDi; - - ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef, - ParaFlags, FontCollection& rFontCollection, - PPTExBulletProvider& rBuProv ); - ParagraphObj( const ParagraphObj& rParargraphObj ); - ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, - PPTExBulletProvider& rBuProv ); - - void CalculateGraphicBulletSize( sal_uInt16 nFontHeight ); - ~ParagraphObj(); - - void Write( SvStream* pStrm ); - sal_uInt32 Count() const { return mnTextSize; }; - - ParagraphObj& operator=( const ParagraphObj& rParagraphObj ); -}; - -struct ImplTextObj -{ - sal_uInt32 mnRefCount; - sal_uInt32 mnTextSize; - int mnInstance; - List* mpList; - sal_Bool mbHasExtendedBullets; - sal_Bool mbFixedCellHeightUsed; - - ImplTextObj( int nInstance ); - ~ImplTextObj(); -}; - -class TextObj -{ - mutable ImplTextObj* mpImplTextObj; - void ImplCalculateTextPositions(); - - public : - TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & - rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ); - TextObj( const TextObj& rTextObj ); - ~TextObj(); - - void Write( SvStream* pStrm ); - - ParagraphObj* First(){ return (ParagraphObj*)mpImplTextObj->mpList->First(); }; - ParagraphObj* Next(){ return(ParagraphObj*)mpImplTextObj->mpList->Next(); }; - sal_uInt32 Count() const { return mpImplTextObj->mnTextSize; }; - int GetInstance() const { return mpImplTextObj->mnInstance; }; - sal_Bool HasExtendedBullets(){ return mpImplTextObj->mbHasExtendedBullets; }; - void WriteTextSpecInfo( SvStream* pStrm ); - - TextObj& operator=( TextObj& rTextObj ); -}; - -// ------------------------------------------------------------------------ struct CellBorder; -class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvider +class PPTWriter : public PPTWriterBase, public PPTExBulletProvider { - sal_Bool mbStatus; - sal_Bool mbUseNewAnimations; - sal_uInt32 mnStatMaxValue; - sal_uInt32 mnLatestStatValue; - std::vector< PPTExStyleSheet* > maStyleSheetList; - PPTExStyleSheet* mpStyleSheet; - - EscherGraphicProvider* mpGraphicProvider; - Fraction maFraction; - MapMode maMapModeSrc; - MapMode maMapModeDest; - ::com::sun::star::awt::Size maDestPageSize; - ::com::sun::star::awt::Size maNotesPageSize; - PageType meLatestPageType; - List maSlideNameList; - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mXModel; - ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier > mXDrawPagesSupplier; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier > mXMasterPagesSupplier; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > mXDrawPages; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPagePropSet; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXBackgroundPropSet; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape; - ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > mXText; // TextRef des globalen Text - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > mXCursor; - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mXCursorText; // TextRef des Teilstuecks des Cursors - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXCursorPropSet; // die Properties des Teilstueckes - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > mXTextField; - ::com::sun::star::awt::Size maSize; - ::com::sun::star::awt::Point maPosition; - Rectangle maRect; - ByteString mType; - sal_Bool mbPresObj; - sal_Bool mbEmptyPresObj; - sal_Bool mbStatusIndicator; - sal_Int32 mnAngle; - sal_uInt32 mnTextStyle; - - sal_Bool mbFontIndependentLineSpacing; - sal_uInt32 mnTextSize; - - SvStorageRef mrStg; - SvStorageStream* mpCurUserStrm; - SvStorageStream* mpStrm; - SvStorageStream* mpPicStrm; - PptEscherEx* mpPptEscherEx; - - List maExOleObj; - sal_uInt32 mnVBAOleOfs; - SvMemoryStream* mpVBA; - sal_uInt32 mnExEmbed; - SvMemoryStream* mpExEmbed; - - sal_uInt32 mnPages; // anzahl einzelner Slides ( ohne masterpages & notes & handout ) - sal_uInt32 mnMasterPages; // - sal_uInt32 mnDrawings; // anzahl Slides + masterpages + notes + handout - sal_uInt32 mnPagesWritten; - sal_uInt32 mnUniqueSlideIdentifier; - sal_uInt32 mnTxId; // Identifier determined by the HOST (PP) ???? - sal_uInt32 mnDiaMode; // 0 -> manuell + sal_uInt32 mnCnvrtFlags; + sal_Bool mbStatus; + sal_Bool mbUseNewAnimations; + sal_uInt32 mnStatMaxValue; + sal_uInt32 mnLatestStatValue; + + EscherGraphicProvider* mpGraphicProvider; + List maSlideNameList; + + ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > mXText; // TextRef des globalen Text + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > mXCursor; + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mXCursorText; // TextRef des Teilstuecks des Cursors + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXCursorPropSet; // die Properties des Teilstueckes + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > mXTextField; + sal_uInt32 mnTextStyle; + + sal_Bool mbFontIndependentLineSpacing; + sal_uInt32 mnTextSize; + + SvStorageRef mrStg; + SvStorageStream* mpCurUserStrm; + SvStorageStream* mpStrm; + SvStorageStream* mpPicStrm; + PptEscherEx* mpPptEscherEx; + + List maExOleObj; + sal_uInt32 mnVBAOleOfs; + SvMemoryStream* mpVBA; + sal_uInt32 mnExEmbed; + SvMemoryStream* mpExEmbed; + + sal_uInt32 mnDrawings; // anzahl Slides + masterpages + notes + handout + sal_uInt32 mnPagesWritten; + sal_uInt32 mnUniqueSlideIdentifier; + sal_uInt32 mnTxId; // Identifier determined by the HOST (PP) ???? + sal_uInt32 mnDiaMode; // 0 -> manuell // 1 -> halbautomatisch // 2 -> automatisch - sal_uInt32 mnShapeMasterTitle; - sal_uInt32 mnShapeMasterBody; + sal_uInt32 mnShapeMasterTitle; + sal_uInt32 mnShapeMasterBody; + + List maHyperlink; - List maHyperlink; + ppt::ExSoundCollection maSoundCollection; - FontCollection maFontCollection; - ppt::ExSoundCollection maSoundCollection; - - PHLayout& ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const; - void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId ); - + void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId ); - sal_uInt32 ImplProgBinaryTag( SvStream* pOutStrm = NULL ); - sal_uInt32 ImplProgBinaryTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL ); - sal_uInt32 ImplProgTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL ); - sal_uInt32 ImplOutlineViewInfoContainer( SvStream* pOutStrm = NULL ); - sal_uInt32 ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pOutStrm = NULL ); - sal_uInt32 ImplVBAInfoContainer( SvStream* pOutStrm = NULL ); - sal_uInt32 ImplDocumentListContainer( SvStream* pOutStrm = NULL ); - sal_uInt32 ImplMasterSlideListContainer( SvStream* pOutStrm = NULL ); + sal_uInt32 ImplProgBinaryTag( SvStream* pOutStrm = NULL ); + sal_uInt32 ImplProgBinaryTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL ); + sal_uInt32 ImplProgTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL ); + sal_uInt32 ImplOutlineViewInfoContainer( SvStream* pOutStrm = NULL ); + sal_uInt32 ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pOutStrm = NULL ); + sal_uInt32 ImplVBAInfoContainer( SvStream* pOutStrm = NULL ); + sal_uInt32 ImplDocumentListContainer( SvStream* pOutStrm = NULL ); + sal_uInt32 ImplMasterSlideListContainer( SvStream* pOutStrm = NULL ); public: - static void WriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 ); + static void WriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 ); protected: - sal_Bool ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags ); - sal_Bool ImplCreateCurrentUserStream(); - void ImplCreateHeaderFooterStrings( SvStream& rOut, + sal_Bool ImplCreateDocumentSummaryInformation(); + sal_Bool ImplCreateCurrentUserStream(); + void ImplCreateHeaderFooterStrings( SvStream& rOut, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet ); - void ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet ); - sal_Bool ImplCreateDocument(); - sal_Bool ImplCreateHyperBlob( SvMemoryStream& rStream ); - sal_uInt32 ImplInsertBookmarkURL( const String& rBookmark, const sal_uInt32 nType, + void ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet ); + virtual sal_Bool ImplCreateDocument(); + sal_Bool ImplCreateHyperBlob( SvMemoryStream& rStream ); + sal_uInt32 ImplInsertBookmarkURL( const String& rBookmark, const sal_uInt32 nType, const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 ); - sal_Bool ImplCreateMaster( sal_uInt32 nPageNum ); - sal_Bool ImplCreateMainNotes(); - sal_Bool ImplCreateSlide( sal_uInt32 nPageNum ); - sal_Bool ImplCreateNotes( sal_uInt32 nPageNum ); - void ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXBackgroundPropSet ); - void ImplWriteVBA( SvMemoryStream* pVBA ); - void ImplWriteOLE( sal_uInt32 nCnvrtFlags ); - sal_Bool ImplWriteAtomEnding(); - - sal_Bool ImplInitSOIface(); - sal_Bool ImplSetCurrentStyleSheet( sal_uInt32 nPageNum ); - sal_Bool ImplGetPageByIndex( sal_uInt32 nIndex, PageType ); - sal_Bool ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup = FALSE ); - sal_uInt32 ImplGetMasterIndex( PageType ePageType ); - void ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt ); - sal_Bool ImplGetText(); - sal_Bool ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType, + virtual sal_Bool ImplCreateMainNotes(); + sal_Bool ImplCreateNotes( sal_uInt32 nPageNum ); + void ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXBackgroundPropSet ); + void ImplWriteVBA(); + void ImplWriteOLE(); + sal_Bool ImplWriteAtomEnding(); + + void ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt ); + sal_Bool ImplGetText(); + sal_Bool ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType, const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId ); - sal_Bool ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, + sal_Bool ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, ::com::sun::star::presentation::AnimationEffect& eEffect, ::com::sun::star::presentation::AnimationEffect& eTextEffect, - sal_Bool& bHasSound ); - void ImplWriteObjectEffect( SvStream& rSt, + sal_Bool& bHasSound ); + void ImplWriteObjectEffect( SvStream& rSt, ::com::sun::star::presentation::AnimationEffect eEffect, ::com::sun::star::presentation::AnimationEffect eTextEffect, sal_uInt16 nOrder ); - void ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eAction, sal_Bool bMediaClickAction ); - sal_Bool ImplGetStyleSheets(); - void ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj ); - void ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj ); - void ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance, + void ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eAction, sal_Bool bMediaClickAction ); + void ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj ); + void ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj ); + void ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance, TextRuleEntry* pTextRule, SvStream& rExtBu, EscherPropertyContainer* ); - void ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt ); - void ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& ); - void ImplCreateTextShape( EscherPropertyContainer&, EscherSolverContainer&, sal_Bool bFill ); + void ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt ); + void ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& ); + void ImplCreateTextShape( EscherPropertyContainer&, EscherSolverContainer&, sal_Bool bFill ); - void ImplWritePage( const PHLayout& rLayout, + void ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& rSolver, PageType ePageType, sal_Bool bMaster, int nPageNumber = 0 ); - void ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 ); - void ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer, + void ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 ); + void ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer, EscherPropertyContainer& aPropOpt ); - ::com::sun::star::awt::Point ImplMapPoint( const ::com::sun::star::awt::Point& ); - ::com::sun::star::awt::Size ImplMapSize( const ::com::sun::star::awt::Size& ); - Rectangle ImplMapRectangle( const ::com::sun::star::awt::Rectangle& ); - sal_Bool ImplCloseDocument(); // die font-, hyper-, Soundliste wird geschrieben .. + sal_Bool ImplCloseDocument(); // die font-, hyper-, Soundliste wird geschrieben .. + + virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterID, sal_uInt16 nMode, + sal_Bool bHasBackground, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet ); + virtual void ImplWriteNotes( sal_uInt32 nPageNum ); + virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet ); public: PPTWriter( SvStorageRef& rSvStorage, @@ -527,9 +295,11 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide ~PPTWriter(); - sal_Bool IsValid() const { return mbStatus; }; -}; + sal_Bool IsValid() const { return mbStatus; }; + virtual void exportPPTPre(); + virtual void exportPPTPost( ); +}; #endif diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 0b425642c..65de34949 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -30,6 +30,7 @@ #include "precompiled_sd.hxx" #include <osl/endian.h> #include <eppt.hxx> +#include "text.hxx" #include "epptdef.hxx" #include "escherex.hxx" #include <tools/poly.hxx> @@ -182,211 +183,6 @@ sal_uInt16 PPTExBulletProvider::GetId( const ByteString& rUniqueId, Size& rGraph // --------------------------------------------------------------------------------------------- -GroupTable::GroupTable() : - mnCurrentGroupEntry ( 0 ), - mnMaxGroupEntry ( 0 ), - mnGroupsClosed ( 0 ), - mpGroupEntry ( NULL ) -{ - ImplResizeGroupTable( 32 ); -} - -// --------------------------------------------------------------------------------------------- - -GroupTable::~GroupTable() -{ - for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; delete mpGroupEntry[ i++ ] ) ; - delete[] mpGroupEntry; -} - -// --------------------------------------------------------------------------------------------- - -void GroupTable::ImplResizeGroupTable( sal_uInt32 nEntrys ) -{ - if ( nEntrys > mnMaxGroupEntry ) - { - mnMaxGroupEntry = nEntrys; - GroupEntry** pTemp = new GroupEntry*[ nEntrys ]; - for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++ ) - pTemp[ i ] = mpGroupEntry[ i ]; - if ( mpGroupEntry ) - delete[] mpGroupEntry; - mpGroupEntry = pTemp; - } -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool GroupTable::EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rXIndexAccessRef ) -{ - sal_Bool bRet = sal_False; - if ( rXIndexAccessRef.is() ) - { - GroupEntry* pNewGroup = new GroupEntry( rXIndexAccessRef ); - if ( pNewGroup->mnCount ) - { - if ( mnMaxGroupEntry == mnCurrentGroupEntry ) - ImplResizeGroupTable( mnMaxGroupEntry + 8 ); - mpGroupEntry[ mnCurrentGroupEntry++ ] = pNewGroup; - bRet = sal_True; - } - else - delete pNewGroup; - } - return bRet; -} - -// --------------------------------------------------------------------------------------------- - -sal_uInt32 GroupTable::GetGroupsClosed() -{ - sal_uInt32 nRet = mnGroupsClosed; - mnGroupsClosed = 0; - return nRet; -} - -// --------------------------------------------------------------------------------------------- - -void GroupTable::ClearGroupTable() -{ - for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++, delete mpGroupEntry[ i ] ) ; - mnCurrentGroupEntry = 0; -} - -// --------------------------------------------------------------------------------------------- - -void GroupTable::ResetGroupTable( sal_uInt32 nCount ) -{ - ClearGroupTable(); - mpGroupEntry[ mnCurrentGroupEntry++ ] = new GroupEntry( nCount ); -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool GroupTable::GetNextGroupEntry() -{ - while ( mnCurrentGroupEntry ) - { - mnIndex = mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCurrentPos++; - - if ( mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCount > mnIndex ) - return TRUE; - - delete ( mpGroupEntry[ --mnCurrentGroupEntry ] ); - - if ( mnCurrentGroupEntry ) - mnGroupsClosed++; - } - return FALSE; -} - -// --------------------------------------------------------------------------------------------- - -FontCollectionEntry::~FontCollectionEntry() -{ -} - -// --------------------------------------------------------------------------------------------- - -void FontCollectionEntry::ImplInit( const String& rName ) -{ - String aSubstName( GetSubsFontName( rName, SUBSFONT_ONLYONE | SUBSFONT_MS ) ); - if ( aSubstName.Len() ) - { - Name = aSubstName; - bIsConverted = sal_True; - } - else - { - Name = rName; - bIsConverted = sal_False; - } -} - -FontCollection::~FontCollection() -{ - for( void* pStr = List::First(); pStr; pStr = List::Next() ) - delete (FontCollectionEntry*)pStr; - delete pVDev; - xPPTBreakIter = NULL; - xScriptTypeDetector = NULL; -} - -FontCollection::FontCollection() : - pVDev ( NULL ) -{ - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - xMSF = ::comphelper::getProcessServiceFactory(); - com::sun::star::uno::Reference< com::sun::star::uno::XInterface > - xInterface = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ); - if ( xInterface.is() ) - xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > - ( xInterface, com::sun::star::uno::UNO_QUERY ); - - xInterface = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.ScriptTypeDetector" ) ); - if ( xInterface.is() ) - xScriptTypeDetector = com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > - ( xInterface, com::sun::star::uno::UNO_QUERY ); -} - -short FontCollection::GetScriptDirection( const String& rString ) const -{ - short nRet = com::sun::star::i18n::ScriptDirection::NEUTRAL; - if ( xScriptTypeDetector.is() ) - { - const rtl::OUString sT( rString ); - nRet = xScriptTypeDetector->getScriptDirection( sT, 0, com::sun::star::i18n::ScriptDirection::NEUTRAL ); - } - return nRet; -} - -sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry ) -{ - if( rEntry.Name.Len() ) - { - const sal_uInt32 nFonts = GetCount(); - - for( sal_uInt32 i = 0; i < nFonts; i++ ) - { - const FontCollectionEntry* pEntry = GetById( i ); - if( pEntry->Name == rEntry.Name ) - return i; - } - Font aFont; - aFont.SetCharSet( rEntry.CharSet ); - aFont.SetName( rEntry.Original ); -// aFont.SetFamily( rEntry.Family ); -// aFont.SetPitch( rEntry.Pitch ); - aFont.SetHeight( 100 ); - - if ( !pVDev ) - pVDev = new VirtualDevice; - - pVDev->SetFont( aFont ); - FontMetric aMetric( pVDev->GetFontMetric() ); - - sal_uInt16 nTxtHeight = (sal_uInt16)aMetric.GetAscent() + (sal_uInt16)aMetric.GetDescent(); - - if ( nTxtHeight ) - { - double fScaling = (double)nTxtHeight / 120.0; - if ( ( fScaling > 0.50 ) && ( fScaling < 1.5 ) ) - rEntry.Scaling = fScaling; - } - - List::Insert( new FontCollectionEntry( rEntry ), LIST_APPEND ); - return nFonts; - } - return 0; -} - -const FontCollectionEntry* FontCollection::GetById( sal_uInt32 nId ) -{ - return (FontCollectionEntry*)List::GetObject( nId ); -} - -// --------------------------------------------------------------------------------------------- - sal_uInt32 PPTWriter::ImplVBAInfoContainer( SvStream* pStrm ) { sal_uInt32 nSize = 28; @@ -683,7 +479,7 @@ sal_Bool PPTWriter::ImplCloseDocument() SvMemoryStream aTxMasterStyleAtomStrm( 0x200, 0x200 ); { EscherExAtom aTxMasterStyleAtom( aTxMasterStyleAtomStrm, EPP_TxMasterStyleAtom, EPP_TEXTTYPE_Other ); - aTxMasterStyleAtomStrm << (sal_uInt16)5; // paragraph count + aTxMasterStyleAtomStrm << (sal_uInt16)5; // paragraph count sal_uInt16 nLev; sal_Bool bFirst = sal_True; for ( nLev = 0; nLev < 5; nLev++ ) @@ -702,7 +498,7 @@ sal_Bool PPTWriter::ImplCloseDocument() + 8 // 1 FontCollection Container + 20 // SrKinsoku Container + 18 // 1 TxSiStyleAtom - + aTxMasterStyleAtomStrm.Tell() // 1 TxMasterStyleAtom; + + aTxMasterStyleAtomStrm.Tell() // 1 TxMasterStyleAtom; + mpStyleSheet->SizeOfTxCFStyleAtom(); sal_uInt32 nBytesToInsert = nEnvironment + 8; @@ -936,360 +732,6 @@ sal_Bool PropStateValue::ImplGetPropertyValue( const String& rString, sal_Bool b // --------------------------------------------------------------------------------------------- -sal_Bool PPTWriter::ImplInitSOIface() -{ - while( TRUE ) - { - mXDrawPagesSupplier = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XDrawPagesSupplier > - ( mXModel, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXDrawPagesSupplier.is() ) - break; - - mXMasterPagesSupplier = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XMasterPagesSupplier > - ( mXModel, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXMasterPagesSupplier.is() ) - break; - mXDrawPages = mXMasterPagesSupplier->getMasterPages(); - if ( !mXDrawPages.is() ) - break; - mnMasterPages = mXDrawPages->getCount(); - mXDrawPages = mXDrawPagesSupplier->getDrawPages(); - if( !mXDrawPages.is() ) - break; - mnPages = mXDrawPages->getCount(); - if ( !ImplGetPageByIndex( 0, NORMAL ) ) - break; - - return TRUE; - } - return FALSE; -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplSetCurrentStyleSheet( sal_uInt32 nPageNum ) -{ - sal_Bool bRet = sal_False; - if ( nPageNum >= maStyleSheetList.size() ) - nPageNum = 0; - else - bRet = sal_True; - mpStyleSheet = maStyleSheetList[ nPageNum ]; - return bRet; -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplGetPageByIndex( sal_uInt32 nIndex, PageType ePageType ) -{ - while( TRUE ) - { - if ( ePageType != meLatestPageType ) - { - switch( ePageType ) - { - case NORMAL : - case NOTICE : - { - mXDrawPages = mXDrawPagesSupplier->getDrawPages(); - if( !mXDrawPages.is() ) - return FALSE; - } - break; - - case MASTER : - { - mXDrawPages = mXMasterPagesSupplier->getMasterPages(); - if( !mXDrawPages.is() ) - return FALSE; - } - break; - default: - break; - } - meLatestPageType = ePageType; - } - ::com::sun::star::uno::Any aAny( mXDrawPages->getByIndex( nIndex ) ); - aAny >>= mXDrawPage; - if ( !mXDrawPage.is() ) - break; - if ( ePageType == NOTICE ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationPage > - aXPresentationPage( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !aXPresentationPage.is() ) - break; - mXDrawPage = aXPresentationPage->getNotesPage(); - if ( !mXDrawPage.is() ) - break; - } - mXPagePropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXPagePropSet.is() ) - break; - - mXShapes = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShapes > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXShapes.is() ) - break; - - /* try to get the "real" background PropertySet. If the normal page is not supporting this property, it is - taken the property from the master */ - sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ), sal_True ); - if ( bHasBackground ) - bHasBackground = ( aAny >>= mXBackgroundPropSet ); - if ( !bHasBackground ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget > - aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( aXMasterPageTarget.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > aXMasterDrawPage; - aXMasterDrawPage = aXMasterPageTarget->getMasterPage(); - if ( aXMasterDrawPage.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXMasterPagePropSet; - aXMasterPagePropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - ( aXMasterDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( aXMasterPagePropSet.is() ) - { - sal_Bool bBackground = GetPropertyValue( aAny, aXMasterPagePropSet, - String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ); - if ( bBackground ) - { - aAny >>= mXBackgroundPropSet; - } - } - } - } - } - return TRUE; - } - return FALSE; -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup ) -{ - while(TRUE) - { - if ( ( bGroup == FALSE ) || ( GetCurrentGroupLevel() == 0 ) ) - { - ::com::sun::star::uno::Any aAny( mXShapes->getByIndex( nIndex ) ); - aAny >>= mXShape; - } - else - { - ::com::sun::star::uno::Any aAny( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() ) ); - aAny >>= mXShape; - } - if ( !mXShape.is() ) - break; - - ::com::sun::star::uno::Any aAny( mXShape->queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >*) 0 ) )); - aAny >>= mXPropSet; - - if ( !mXPropSet.is() ) - break; - maPosition = ImplMapPoint( mXShape->getPosition() ); - maSize = ImplMapSize( mXShape->getSize() ); - maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) ); - mType = ByteString( String( mXShape->getShapeType() ), RTL_TEXTENCODING_UTF8 ); - mType.Erase( 0, 13 ); // "com.sun.star." entfernen - sal_uInt16 nPos = mType.Search( (const char*)"Shape" ); - mType.Erase( nPos, 5 ); - - mbPresObj = mbEmptyPresObj = FALSE; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsPresentationObject" ) ) ) ) - mAny >>= mbPresObj; - - if ( mbPresObj && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEmptyPresentationObject" ) ) ) ) - mAny >>= mbEmptyPresObj; - - mnAngle = ( PropValue::GetPropertyValue( aAny, - mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) ) - ? *((sal_Int32*)aAny.getValue() ) - : 0; - - return TRUE; - } - return FALSE; -} - -// ----------------------------------------------------------------------- - -sal_uInt32 PPTWriter::ImplGetMasterIndex( PageType ePageType ) -{ - sal_uInt32 nRetValue = 0; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget > - aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXMasterPageTarget.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > - aXDrawPage = aXMasterPageTarget->getMasterPage(); - if ( aXDrawPage.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - aXPropertySet( aXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXPropertySet.is() ) - { - if ( ImplGetPropertyValue( aXPropertySet, String( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) ) - nRetValue |= *(sal_Int16*)mAny.getValue(); - if ( nRetValue & 0xffff ) // ueberlauf vermeiden - nRetValue--; - } - } - } - if ( ePageType == NOTICE ) - nRetValue += mnMasterPages; - return nRetValue; -} - -// ----------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplGetStyleSheets() -{ - int nInstance, nLevel; - sal_Bool bRetValue = sal_False; - sal_uInt32 nPageNum; - - for ( nPageNum = 0; nPageNum < mnMasterPages; nPageNum++ ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > - aXNamed; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - aXNameAccess; - - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyleFamiliesSupplier > - aXStyleFamiliesSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY ); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - aXPropSet( mXModel, ::com::sun::star::uno::UNO_QUERY ); - - sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TabStop" ) ) ) ) - ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 ) - : 1250; - - maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, (PPTExBulletProvider&)*this ) ); - ImplSetCurrentStyleSheet( nPageNum ); - if ( ImplGetPageByIndex( nPageNum, MASTER ) ) - aXNamed = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXStyleFamiliesSupplier.is() ) - aXNameAccess = aXStyleFamiliesSupplier->getStyleFamilies(); - - bRetValue = aXNamed.is() && aXNameAccess.is() && aXStyleFamiliesSupplier.is(); - if ( bRetValue ) - { - for ( nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_CenterTitle; nInstance++ ) - { - String aStyle; - String aFamily; - switch ( nInstance ) - { - case EPP_TEXTTYPE_CenterTitle : - case EPP_TEXTTYPE_Title : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "title" ) ); - aFamily = aXNamed->getName(); - } - break; - case EPP_TEXTTYPE_Body : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "outline1" ) ); // SD_LT_SEPARATOR - aFamily = aXNamed->getName(); - } - break; - case EPP_TEXTTYPE_Other : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ); - aFamily = String( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); - } - break; - case EPP_TEXTTYPE_CenterBody : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "subtitle" ) ); - aFamily = aXNamed->getName(); - } - break; - } - if ( aStyle.Len() && aFamily.Len() ) - { - try - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >xNameAccess; - if ( aXNameAccess->hasByName( aFamily ) ) - { - ::com::sun::star::uno::Any aAny( aXNameAccess->getByName( aFamily ) ); - if( aAny.getValue() && ::cppu::extractInterface( xNameAccess, aAny ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > aXFamily; - if ( aAny >>= aXFamily ) - { - if ( aXFamily->hasByName( aStyle ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > xStyle; - aAny = aXFamily->getByName( aStyle ); - if( aAny.getValue() && ::cppu::extractInterface( xStyle, aAny ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > aXStyle; - aAny >>= aXStyle; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xPropSet( aXStyle, ::com::sun::star::uno::UNO_QUERY ); - if( xPropSet.is() ) - mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, 0 ); - for ( nLevel = 1; nLevel < 5; nLevel++ ) - { - if ( nInstance == EPP_TEXTTYPE_Body ) - { - sal_Unicode cTemp = aStyle.GetChar( aStyle.Len() - 1 ); - aStyle.SetChar( aStyle.Len() - 1, ++cTemp ); - if ( aXFamily->hasByName( aStyle ) ) - { - aXFamily->getByName( aStyle ) >>= xStyle; - if( xStyle.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xPropertySet( xStyle, ::com::sun::star::uno::UNO_QUERY ); - if ( xPropertySet.is() ) - mpStyleSheet->SetStyleSheet( xPropertySet, maFontCollection, nInstance, nLevel ); - } - } - } - else - mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, nLevel ); - } - } - } - } - } - } - } - catch( ::com::sun::star::uno::Exception& ) - { - // - } - } - } - for ( ; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - - } - } - } - return bRetValue; -} - -// ----------------------------------------------------------------------- - void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) { sal_Bool bFirstParagraph = TRUE; @@ -1321,7 +763,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) fN *= pDesc->Scaling; nNormalSpacing = (sal_Int16)( fN + 0.5 ); } - if ( !mbFontIndependentLineSpacing && bFirstParagraph && ( nLineSpacing > nNormalSpacing ) ) // sj: i28747, no replacement for fixed linespacing + if ( !mbFontIndependentLineSpacing && bFirstParagraph && ( nLineSpacing > nNormalSpacing ) ) // sj: i28747, no replacement for fixed linespacing { nLineSpacing = nNormalSpacing; nPropertyFlags |= 0x00001000; @@ -1360,7 +802,6 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) ( mpStyleSheet->IsHardAttribute( nInstance, nDepth, ParaAttr_BiDi, pPara->mnBiDi ) ) ) nPropertyFlags |= 0x00200000; - sal_Int32 nBuRealSize = pPara->nBulletRealSize; sal_Int16 nBulletFlags = pPara->nBulletFlags; @@ -1455,8 +896,8 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) { sal_uInt32 nBackgroundColor = 0xffffff; - if ( !nCharColor ) // special threatment for - nCharColor = 0xffffff; // black fontcolor + if ( !nCharColor ) // special threatment for + nCharColor = 0xffffff; // black fontcolor ::com::sun::star::uno::Any aAny; ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE ); @@ -1524,7 +965,7 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) // not possible to export the 'embossed' flag if ( ( GetCurrentGroupLevel() > 0 ) && ( GetCurrentGroupIndex() >= 1 ) ) { - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aGroupedShape( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() - 1 ), uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aGroupedShape( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() - 1 ), uno::UNO_QUERY ); if( aGroupedShape.is() ) { ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aPropSetOfNextShape @@ -1666,1362 +1107,6 @@ void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt ) // ----------------------------------------------------------------------- -struct FieldEntry -{ - sal_uInt32 nFieldType; - sal_uInt32 nFieldStartPos; - sal_uInt32 nFieldEndPos; - String aRepresentation; - String aFieldUrl; - - FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd ) - { - nFieldType = nType; - nFieldStartPos = nStart; - nFieldEndPos = nEnd; - } -}; - -// ----------------------------------------------------------------------- - -PortionObj::PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection ) : - mnCharAttrHard ( 0 ), - mnCharAttr ( 0 ), - mnFont ( 0 ), - mnAsianOrComplexFont( 0xffff ), - mnTextSize ( 0 ), - mbLastPortion ( TRUE ), - mpText ( NULL ), - mpFieldEntry ( NULL ) -{ - mXPropSet = rXPropSet; - - ImplGetPortionValues( rFontCollection, FALSE ); -} - -PortionObj::PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRange, - sal_Bool bLast, FontCollection& rFontCollection ) : - mnCharAttrHard ( 0 ), - mnCharAttr ( 0 ), - mnFont ( 0 ), - mnAsianOrComplexFont ( 0xffff ), - mbLastPortion ( bLast ), - mpText ( NULL ), - mpFieldEntry ( NULL ) -{ - String aString( rXTextRange->getString() ); - String aURL; - BOOL bRTL_endingParen = FALSE; - - mnTextSize = aString.Len(); - if ( bLast ) - mnTextSize++; - - if ( mnTextSize ) - { - mpFieldEntry = NULL; - sal_uInt32 nFieldType = 0; - - mXPropSet = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - ( rXTextRange, ::com::sun::star::uno::UNO_QUERY ); - mXPropState = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyState > - ( rXTextRange, ::com::sun::star::uno::UNO_QUERY ); - - sal_Bool bPropSetsValid = ( mXPropSet.is() && mXPropState.is() ); - if ( bPropSetsValid ) - nFieldType = ImplGetTextField( rXTextRange, mXPropSet, aURL ); - if ( nFieldType ) - { - mpFieldEntry = new FieldEntry( nFieldType, 0, mnTextSize ); - if ( ( nFieldType >> 28 == 4 ) ) - { - mpFieldEntry->aRepresentation = aString; - mpFieldEntry->aFieldUrl = aURL; - } - } - sal_Bool bSymbol = FALSE; - - if ( bPropSetsValid && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), FALSE ) ) - { - sal_Int16 nCharset; - mAny >>= nCharset; - if ( nCharset == ::com::sun::star::awt::CharSet::SYMBOL ) - bSymbol = TRUE; - } - if ( mpFieldEntry && ( nFieldType & 0x800000 ) ) // placeholder ? - { - mnTextSize = 1; - if ( bLast ) - mnTextSize++; - mpText = new sal_uInt16[ mnTextSize ]; - mpText[ 0 ] = 0x2a; - } - else - { - const sal_Unicode* pText = aString.GetBuffer(); - // For i39516 - a closing parenthesis that ends an RTL string is displayed backwards by PPT - // Solution: add a Unicode Right-to-Left Mark, following the method described in i18024 - if ( bLast && pText[ aString.Len() - 1 ] == sal_Unicode(')') && rFontCollection.GetScriptDirection( aString ) == com::sun::star::i18n::ScriptDirection::RIGHT_TO_LEFT ) - { - mnTextSize++; - bRTL_endingParen = TRUE; - } - mpText = new sal_uInt16[ mnTextSize ]; - sal_uInt16 nChar; - for ( int i = 0; i < aString.Len(); i++ ) - { - nChar = (sal_uInt16)pText[ i ]; - if ( nChar == 0xa ) - nChar++; - else if ( !bSymbol ) - { - switch ( nChar ) - { - // Currency - case 128: nChar = 0x20AC; break; - // Punctuation and other - case 130: nChar = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK - case 131: nChar = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK - case 132: nChar = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK - // LOW DOUBLE PRIME QUOTATION MARK - case 133: nChar = 0x2026; break;// HORIZONTAL ELLIPSES - case 134: nChar = 0x2020; break;// DAGGER - case 135: nChar = 0x2021; break;// DOUBLE DAGGER - case 136: nChar = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT - case 137: nChar = 0x2030; break;// PER MILLE SIGN - case 138: nChar = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON - case 139: nChar = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK - case 140: nChar = 0x0152; break;// LATIN CAPITAL LIGATURE OE - case 142: nChar = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON - case 145: nChar = 0x2018; break;// LEFT SINGLE QUOTATION MARK - // MODIFIER LETTER TURNED COMMA - case 146: nChar = 0x2019; break;// RIGHT SINGLE QUOTATION MARK - // MODIFIER LETTER APOSTROPHE - case 147: nChar = 0x201C; break;// LEFT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 148: nChar = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 149: nChar = 0x2022; break;// BULLET - case 150: nChar = 0x2013; break;// EN DASH - case 151: nChar = 0x2014; break;// EM DASH - case 152: nChar = 0x02DC; break;// SMALL TILDE - case 153: nChar = 0x2122; break;// TRADE MARK SIGN - case 154: nChar = 0x0161; break;// LATIN SMALL LETTER S WITH CARON - case 155: nChar = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - case 156: nChar = 0x0153; break;// LATIN SMALL LIGATURE OE - case 158: nChar = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON - case 159: nChar = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS -// case 222: nChar = 0x00B6; break;// PILCROW SIGN / PARAGRAPH SIGN - } - } - mpText[ i ] = nChar; - } - } - if ( bRTL_endingParen ) - mpText[ mnTextSize - 2 ] = 0x200F; // Unicode Right-to-Left mark - - if ( bLast ) - mpText[ mnTextSize - 1 ] = 0xd; - - if ( bPropSetsValid ) - ImplGetPortionValues( rFontCollection, TRUE ); - } -} - -PortionObj::PortionObj( const PortionObj& rPortionObj ) -: PropStateValue( rPortionObj ) -{ - ImplConstruct( rPortionObj ); -} - -PortionObj::~PortionObj() -{ - ImplClear(); -} - -void PortionObj::Write( SvStream* pStrm, sal_Bool bLast ) -{ - sal_uInt32 nCount = mnTextSize; - if ( bLast && mbLastPortion ) - nCount--; - for ( sal_uInt32 i = 0; i < nCount; i++ ) - *pStrm << (sal_uInt16)mpText[ i ]; -} - -void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue ) -{ - - sal_Bool bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), bGetPropStateValue ); - meFontName = ePropState; - if ( bOk ) - { - FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() ); - sal_uInt32 nCount = rFontCollection.GetCount(); - mnFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); - if ( mnFont == nCount ) - { - FontCollectionEntry& rFontDesc = rFontCollection.GetLast(); - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), sal_False ) ) - mAny >>= rFontDesc.CharSet; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamily" ) ), sal_False ) ) - mAny >>= rFontDesc.Family; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitch" ) ), sal_False ) ) - mAny >>= rFontDesc.Pitch; - } - } - - sal_Int16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguage() ); - if ( mpText && mnTextSize && xPPTBreakIter.is() ) - { - rtl::OUString sT( mpText, mnTextSize ); - nScriptType = xPPTBreakIter->getScriptType( sT, 0 ); - } - if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX ) - { - bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameAsian" ) ), bGetPropStateValue ); - meAsianOrComplexFont = ePropState; - if ( bOk ) - { - FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() ); - sal_uInt32 nCount = rFontCollection.GetCount(); - mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); - if ( mnAsianOrComplexFont == nCount ) - { - FontCollectionEntry& rFontDesc = rFontCollection.GetLast(); - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetAsian" ) ), sal_False ) ) - mAny >>= rFontDesc.CharSet; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyAsian" ) ), sal_False ) ) - mAny >>= rFontDesc.Family; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchAsian" ) ), sal_False ) ) - mAny >>= rFontDesc.Pitch; - } - } - } - else - { - bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameComplex" ) ), bGetPropStateValue ); - meAsianOrComplexFont = ePropState; - if ( bOk ) - { - FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() ); - sal_uInt32 nCount = rFontCollection.GetCount(); - mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); - if ( mnAsianOrComplexFont == nCount ) - { - FontCollectionEntry& rFontDesc = rFontCollection.GetLast(); - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetComplex" ) ), sal_False ) ) - mAny >>= rFontDesc.CharSet; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyComplex" ) ), sal_False ) ) - mAny >>= rFontDesc.Family; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchComplex" ) ), sal_False ) ) - mAny >>= rFontDesc.Pitch; - } - } - } - - rtl::OUString aCharHeightName, aCharWeightName, aCharLocaleName, aCharPostureName; - switch( nScriptType ) - { - case com::sun::star::i18n::ScriptType::ASIAN : - { - aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeightAsian" ) ); - aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightAsian" ) ); - aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocaleAsian" ) ); - aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureAsian" ) ); - break; - } - case com::sun::star::i18n::ScriptType::COMPLEX : - { - aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeightComplex" ) ); - aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightComplex" ) ); - aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocaleComplex" ) ); - aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureComplex" ) ); - break; - } - default: - { - aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ); - aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ); - aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ); - aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ); - break; - } - } - - mnCharHeight = 24; - if ( GetPropertyValue( mAny, mXPropSet, aCharHeightName, sal_False ) ) - { - float fVal(0.0); - if ( mAny >>= fVal ) - { - mnCharHeight = (sal_uInt16)( fVal + 0.5 ); - meCharHeight = GetPropertyState( mXPropSet, aCharHeightName ); - } - } - if ( GetPropertyValue( mAny, mXPropSet, aCharWeightName, sal_False ) ) - { - float fFloat(0.0); - if ( mAny >>= fFloat ) - { - if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD ) - mnCharAttr |= 1; - if ( GetPropertyState( mXPropSet, aCharWeightName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 1; - } - } - if ( GetPropertyValue( mAny, mXPropSet, aCharLocaleName, sal_False ) ) - { - com::sun::star::lang::Locale eLocale; - if ( mAny >>= eLocale ) - meCharLocale = eLocale; - } - if ( GetPropertyValue( mAny, mXPropSet, aCharPostureName, sal_False ) ) - { - ::com::sun::star::awt::FontSlant aFS; - if ( mAny >>= aFS ) - { - switch( aFS ) - { - case ::com::sun::star::awt::FontSlant_OBLIQUE : - case ::com::sun::star::awt::FontSlant_ITALIC : - mnCharAttr |= 2; - break; - default: - break; - } - if ( GetPropertyState( mXPropSet, aCharPostureName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 2; - } - } - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), bGetPropStateValue ) ) - { - sal_Int16 nVal(0); - mAny >>= nVal; - switch ( nVal ) - { - case ::com::sun::star::awt::FontUnderline::SINGLE : - case ::com::sun::star::awt::FontUnderline::DOUBLE : - case ::com::sun::star::awt::FontUnderline::DOTTED : - mnCharAttr |= 4; - } - } - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 4; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), bGetPropStateValue ) ) - { - sal_Bool bBool(sal_False); - mAny >>= bBool; - if ( bBool ) - mnCharAttr |= 0x10; - } - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 16; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharRelief" ) ), bGetPropStateValue ) ) - { - sal_Int16 nVal(0); - mAny >>= nVal; - if ( nVal != ::com::sun::star::text::FontRelief::NONE ) - mnCharAttr |= 512; - } - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 512; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ), bGetPropStateValue ) ) - { - sal_uInt32 nSOColor = *( (sal_uInt32*)mAny.getValue() ); - mnCharColor = nSOColor & 0xff00ff00; // green and hibyte - mnCharColor |= (sal_uInt8)( nSOColor ) << 16; // red and blue is switched - mnCharColor |= (sal_uInt8)( nSOColor >> 16 ); - } - meCharColor = ePropState; - - mnCharEscapement = 0; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), bGetPropStateValue ) ) - { - mAny >>= mnCharEscapement; - if ( mnCharEscapement > 100 ) - mnCharEscapement = 33; - else if ( mnCharEscapement < -100 ) - mnCharEscapement = -33; - } - meCharEscapement = ePropState; -} - -void PortionObj::ImplClear() -{ - delete (FieldEntry*)mpFieldEntry; - delete[] mpText; -} - -void PortionObj::ImplConstruct( const PortionObj& rPortionObj ) -{ - mbLastPortion = rPortionObj.mbLastPortion; - mnTextSize = rPortionObj.mnTextSize; - mnCharColor = rPortionObj.mnCharColor; - mnCharEscapement = rPortionObj.mnCharEscapement; - mnCharAttr = rPortionObj.mnCharAttr; - mnCharHeight = rPortionObj.mnCharHeight; - mnFont = rPortionObj.mnFont; - mnAsianOrComplexFont = rPortionObj.mnAsianOrComplexFont; - - if ( rPortionObj.mpText ) - { - mpText = new sal_uInt16[ mnTextSize ]; - memcpy( mpText, rPortionObj.mpText, mnTextSize << 1 ); - } - else - mpText = NULL; - - if ( rPortionObj.mpFieldEntry ) - mpFieldEntry = new FieldEntry( *( rPortionObj.mpFieldEntry ) ); - else - mpFieldEntry = NULL; -} - -sal_uInt32 PortionObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ) -{ - if ( mpFieldEntry && ( !mpFieldEntry->nFieldStartPos ) ) - { - mpFieldEntry->nFieldStartPos += nCurrentTextPosition; - mpFieldEntry->nFieldEndPos += nCurrentTextPosition; - } - return mnTextSize; -} - -// ----------------------------------------------------------------------- -// Rueckgabe: 0 = kein TextField -// bit28->31 text field type : -// 1 = Date -// 2 = Time -// 3 = SlideNumber -// 4 = Url -// 5 = DateTime -// 6 = header -// 7 = footer -// bit24->27 text field sub type (optional) -// 23-> PPT Textfield needs a placeholder - -sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & , - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, String& rURL ) -{ - sal_uInt32 nRetValue = 0; - sal_Int32 nFormat; - ::com::sun::star::uno::Any aAny; - if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextPortionType" ) ), sal_True ) ) - { - String aTextFieldType( *(::rtl::OUString*)aAny.getValue() ); - if ( aTextFieldType == String( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) ) ) - { - if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, sal_True ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > aXTextField; - if ( aAny >>= aXTextField ) - { - if ( aXTextField.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xFieldPropSet( aXTextField, ::com::sun::star::uno::UNO_QUERY ); - if ( xFieldPropSet.is() ) - { - String aFieldKind( aXTextField->getPresentation( TRUE ) ); - if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - sal_Bool bBool; - aAny >>= bBool; - if ( !bBool ) // Fixed DateFields gibt es in PPT nicht - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True ) - { - nFormat = *(sal_Int32*)aAny.getValue(); - switch ( nFormat ) - { - default: - case 5 : - case 4 : - case 2 : nFormat = 0; break; - case 8 : - case 9 : - case 3 : nFormat = 1; break; - case 7 : - case 6 : nFormat = 2; break; - } - nRetValue |= ( ( ( 1 << 4 ) | nFormat ) << 24 ) | 0x800000; - } - } - } - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ), sal_True ) - rURL = String( *(::rtl::OUString*)aAny.getValue() ); - nRetValue = 4 << 28; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Page" ) ) ) - { - nRetValue = 3 << 28 | 0x800000; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Time" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - sal_Bool bBool; - aAny >>= bBool; - if ( !bBool ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - nFormat = *(sal_Int32*)aAny.getValue(); - nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000; - } - } - } - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtTime" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - sal_Bool bBool; - aAny >>= bBool; - if ( !bBool ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True ) - { - nFormat = *(sal_Int32*)aAny.getValue(); - switch ( nFormat ) - { - default: - case 6 : - case 7 : - case 8 : - case 2 : nFormat = 12; break; - case 3 : nFormat = 9; break; - case 5 : - case 4 : nFormat = 10; break; - - } - nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000; - } - } - } - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtFile" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "DateTime" ) ) ) - { - nRetValue = 5 << 28 | 0x800000; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Header" ) ) ) - { - nRetValue = 6 << 28 | 0x800000; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Footer" ) ) ) - { - nRetValue = 7 << 28 | 0x800000; - } - } - } - } - } - } - } - return nRetValue; -} - -PortionObj& PortionObj::operator=( const PortionObj& rPortionObj ) -{ - if ( this != &rPortionObj ) - { - ImplClear(); - ImplConstruct( rPortionObj ); - } - return *this; -} - -// ----------------------------------------------------------------------- - -ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - PPTExBulletProvider& rProv ) : - maMapModeSrc ( MAP_100TH_MM ), - maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ) -{ - mXPropSet = rXPropSet; - - bExtendedParameters = FALSE; - - nDepth = 0; - nBulletFlags = 0; - nParaFlags = 0; - - ImplGetParagraphValues( rProv, FALSE ); -} - - ParagraphObj::ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent, - ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) : - maMapModeSrc ( MAP_100TH_MM ), - maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ), - mbFirstParagraph ( aParaFlags.bFirstParagraph ), - mbLastParagraph ( aParaFlags.bLastParagraph ) -{ - bExtendedParameters = FALSE; - - nDepth = 0; - nBulletFlags = 0; - nParaFlags = 0; - - mXPropSet = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - ( rXTextContent, ::com::sun::star::uno::UNO_QUERY ); - - mXPropState = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyState > - ( rXTextContent, ::com::sun::star::uno::UNO_QUERY ); - - if ( mXPropSet.is() && mXPropState.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > - aXTextPortionEA( rXTextContent, ::com::sun::star::uno::UNO_QUERY ); - if ( aXTextPortionEA.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > - aXTextPortionE( aXTextPortionEA->createEnumeration() ); - if ( aXTextPortionE.is() ) - { - while ( aXTextPortionE->hasMoreElements() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > aXCursorText; - ::com::sun::star::uno::Any aAny( aXTextPortionE->nextElement() ); - if ( aAny >>= aXCursorText ) - { - PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection ); - if ( pPortionObj->Count() ) - Insert( pPortionObj, LIST_APPEND ); - else - delete pPortionObj; - } - } - } - } - ImplGetParagraphValues( rProv, TRUE );// - } -} - -ParagraphObj::ParagraphObj( const ParagraphObj& rObj ) -: List() -, PropStateValue() -, SOParagraph() -{ - ImplConstruct( rObj ); -} - -ParagraphObj::~ParagraphObj() -{ - ImplClear(); -} - -void ParagraphObj::Write( SvStream* pStrm ) -{ - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - ((PortionObj*)pPtr)->Write( pStrm, mbLastParagraph ); -} - -void ParagraphObj::ImplClear() -{ - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - delete (PortionObj*)pPtr; -} - -void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight ) -{ - if ( ( (SvxExtNumType)nNumberingType == SVX_NUM_BITMAP ) && ( nBulletId != 0xffff ) ) - { - // calculate the bulletrealsize for this grafik - if ( aBuGraSize.Width() && aBuGraSize.Height() ) - { - double fCharHeight = nFontHeight; - double fLen = aBuGraSize.Height(); - fCharHeight = fCharHeight * 0.2540; - double fQuo = fLen / fCharHeight; - nBulletRealSize = (sal_Int16)( fQuo + 0.5 ); - if ( (sal_uInt16)nBulletRealSize > 400 ) - nBulletRealSize = 400; - } - } -} - -// from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact -static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName) -{ - sal_Unicode cChar = rNumStr.GetChar(0); - StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont(); - String sFont = pConvert->ConvertChar(cChar); - delete pConvert; - if (sFont.Len()) - { - rNumStr = static_cast< sal_Unicode >(cChar | 0xF000); - rFontName = sFont; - rChrSet = RTL_TEXTENCODING_SYMBOL; - } - else if ( (rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 0xF8FF) ) - { - /* - Ok we can't fit into a known windows unicode font, but - we are not in the private area, so we are a - standardized symbol, so turn off the symbol bit and - let words own font substitution kick in - */ - rChrSet = RTL_TEXTENCODING_UNICODE; - rFontName = ::GetFontToken(rFontName, 0); - } - else - { - /* - Well we don't have an available substition, and we're - in our private area, so give up and show a standard - bullet symbol - */ - rFontName.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings")); - rNumStr = static_cast< sal_Unicode >(0x6C); - } -} - -void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue ) -{ - ::com::sun::star::uno::Any aAny; - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaLeftMargin" ) ) ) ) - { - sal_Int32 nVal; - if ( aAny >>= nVal ) - nTextOfs = static_cast< sal_Int16 >( nVal / ( 2540.0 / 576 ) + 0.5 ) ; - } - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaFirstLineIndent" ) ) ) ) - { - if ( aAny >>= nBulletOfs ) - nBulletOfs = static_cast< sal_Int32 >( nBulletOfs / ( 2540.0 / 576 ) + 0.5 ); - } - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsNumber" ) ) ) ) - aAny >>= bNumberingIsNumber; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > aXIndexReplace; - - if ( bIsBullet && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ), bGetPropStateValue ) ) - { - if ( ( mAny >>= aXIndexReplace ) && nNumberingDepth < aXIndexReplace->getCount() ) - { - mAny <<= aXIndexReplace->getByIndex( nNumberingDepth ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> - aPropertySequence( *( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>*)mAny.getValue() ); - - const ::com::sun::star::beans::PropertyValue* pPropValue = aPropertySequence.getArray(); - - sal_Int32 nPropertyCount = aPropertySequence.getLength(); - if ( nPropertyCount ) - { - bExtendedParameters = TRUE; - nBulletRealSize = 100; - nMappedNumType = 0; - - String aGraphicURL; - for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) - { - const void* pValue = pPropValue[ i ].Value.getValue(); - if ( pValue ) - { - ::rtl::OUString aPropName( pPropValue[ i ].Name ); - if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NumberingType" ) ) ) - nNumberingType = *( (sal_Int16*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Adjust" ) ) ) - nHorzAdjust = *( (sal_Int16*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletChar" ) ) ) - { - String aString( *( (String*)pValue ) ); - if ( aString.Len() ) - cBulletId = aString.GetChar( 0 ); - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletFont" ) ) ) - { - aFontDesc = *( (::com::sun::star::awt::FontDescriptor*)pValue ); - - // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font, - // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used. - // Because there might exist a lot of damaged documemts I added this two lines - // which fixes the bullet problem for the export. - if ( aFontDesc.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ) ) - aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252; - - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicURL" ) ) ) - aGraphicURL = ( *(::rtl::OUString*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicSize" ) ) ) - { - if ( pPropValue[ i ].Value.getValueType() == ::getCppuType( (::com::sun::star::awt::Size*)0) ) - { - // don't cast awt::Size to Size as on 64-bits they are not the same. - ::com::sun::star::awt::Size aSize; - pPropValue[ i ].Value >>= aSize; - aBuGraSize.nA = aSize.Width; - aBuGraSize.nB = aSize.Height; - } - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartWith" ) ) ) - nStartWith = *( (sal_Int16*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ) ) ) - nTextOfs = nTextOfs + static_cast< sal_Int16 >( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FirstLineOffset" ) ) ) - nBulletOfs += (sal_Int16)( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletColor" ) ) ) - { - sal_uInt32 nSOColor = *( (sal_uInt32*)pValue ); - nBulletColor = nSOColor & 0xff00ff00; // green and hibyte - nBulletColor |= (sal_uInt8)( nSOColor ) << 16; // red - nBulletColor |= (sal_uInt8)( nSOColor >> 16 ) | 0xfe000000; // blue - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletRelSize" ) ) ) - { - nBulletRealSize = *( (sal_Int16*)pValue ); - nParaFlags |= 0x40; - nBulletFlags |= 8; - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Prefix" ) ) ) - sPrefix = ( *(::rtl::OUString*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Suffix" ) ) ) - sSuffix = ( *(::rtl::OUString*)pValue ); -#ifdef DBG_UTIL - else if ( ! ( - ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SymbolTextDistance" ) ) ) - || ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Graphic" ) ) ) ) ) - { - DBG_ERROR( "Unbekanntes Property" ); - } -#endif - } - } - - if ( aGraphicURL.Len() ) - { - if ( aBuGraSize.Width() && aBuGraSize.Height() ) - { - xub_StrLen nIndex = aGraphicURL.Search( (sal_Unicode)':', 0 ); - if ( nIndex != STRING_NOTFOUND ) - { - nIndex++; - if ( aGraphicURL.Len() > nIndex ) - { - ByteString aUniqueId( aGraphicURL, nIndex, aGraphicURL.Len() - nIndex, RTL_TEXTENCODING_UTF8 ); - if ( aUniqueId.Len() ) - { - nBulletId = rBuProv.GetId( aUniqueId, aBuGraSize ); - if ( nBulletId != 0xffff ) - bExtendedBulletsUsed = TRUE; - } - } - } - } - else - { - nNumberingType = SVX_NUM_NUMBER_NONE; - } - } - - PortionObj* pPortion = (PortionObj*)First(); - CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 ); - - switch( (SvxExtNumType)nNumberingType ) - { - case SVX_NUM_NUMBER_NONE : nParaFlags |= 0xf; break; - - case SVX_NUM_CHAR_SPECIAL : // Bullet - { - if ( aFontDesc.Name.equalsIgnoreAsciiCaseAscii("starsymbol") || - aFontDesc.Name.equalsIgnoreAsciiCaseAscii("opensymbol") ) - { - String sFontName = aFontDesc.Name; - String sNumStr = cBulletId; - rtl_TextEncoding eChrSet = aFontDesc.CharSet; - lcl_SubstituteBullet(sNumStr,eChrSet,sFontName); - aFontDesc.Name = sFontName; - cBulletId = sNumStr.GetChar( 0 ); - aFontDesc.CharSet = eChrSet; - } - - if ( aFontDesc.Name.getLength() ) - { -/* - if ( aFontDesc.CharSet != ::com::sun::star::awt::CharSet::SYMBOL ) - { - switch ( cBulletId ) - { - // Currency - case 128: cBulletId = 0x20AC; break; - // Punctuation and other - case 130: cBulletId = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK - case 131: cBulletId = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK - case 132: cBulletId = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK - // LOW DOUBLE PRIME QUOTATION MARK - case 133: cBulletId = 0x2026; break;// HORIZONTAL ELLIPSES - case 134: cBulletId = 0x2020; break;// DAGGER - case 135: cBulletId = 0x2021; break;// DOUBLE DAGGER - case 136: cBulletId = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT - case 137: cBulletId = 0x2030; break;// PER MILLE SIGN - case 138: cBulletId = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON - case 139: cBulletId = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK - case 140: cBulletId = 0x0152; break;// LATIN CAPITAL LIGATURE OE - case 142: cBulletId = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON - case 145: cBulletId = 0x2018; break;// LEFT SINGLE QUOTATION MARK - // MODIFIER LETTER TURNED COMMA - case 146: cBulletId = 0x2019; break;// RIGHT SINGLE QUOTATION MARK - // MODIFIER LETTER APOSTROPHE - case 147: cBulletId = 0x201C; break;// LEFT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 148: cBulletId = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 149: cBulletId = 0x2022; break;// BULLET - case 150: cBulletId = 0x2013; break;// EN DASH - case 151: cBulletId = 0x2014; break;// EM DASH - case 152: cBulletId = 0x02DC; break;// SMALL TILDE - case 153: cBulletId = 0x2122; break;// TRADE MARK SIGN - case 154: cBulletId = 0x0161; break;// LATIN SMALL LETTER S WITH CARON - case 155: cBulletId = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - case 156: cBulletId = 0x0153; break;// LATIN SMALL LIGATURE OE - case 158: cBulletId = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON - case 159: cBulletId = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS -// case 222: cBulletId = 0x00B6; break;// PILCROW SIGN / PARAGRAPH SIGN - } - } -*/ - nParaFlags |= 0x90; // wir geben den Font und den Charset vor - } - } - case SVX_NUM_CHARS_UPPER_LETTER : // zaehlt von a-z, aa - az, ba - bz, ... - case SVX_NUM_CHARS_LOWER_LETTER : - case SVX_NUM_ROMAN_UPPER : - case SVX_NUM_ROMAN_LOWER : - case SVX_NUM_ARABIC : - case SVX_NUM_PAGEDESC : // Numerierung aus der Seitenvorlage - case SVX_NUM_BITMAP : - case SVX_NUM_CHARS_UPPER_LETTER_N : // zaehlt von a-z, aa-zz, aaa-zzz - case SVX_NUM_CHARS_LOWER_LETTER_N : - { - if ( nNumberingType != SVX_NUM_CHAR_SPECIAL ) - { - bExtendedBulletsUsed = TRUE; - if ( nNumberingDepth & 1 ) - cBulletId = 0x2013; // defaulting bullet characters for ppt97 - else if ( nNumberingDepth == 4 ) - cBulletId = 0xbb; - else - cBulletId = 0x2022; - - switch( (SvxExtNumType)nNumberingType ) - { - case SVX_NUM_CHARS_UPPER_LETTER : - case SVX_NUM_CHARS_UPPER_LETTER_N : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0xa0001; // (A) - else - nMappedNumType = 0xb0001; // A) - } - else - nMappedNumType = 0x10001; // A. - } - break; - case SVX_NUM_CHARS_LOWER_LETTER : - case SVX_NUM_CHARS_LOWER_LETTER_N : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0x80001; // (a) - else - nMappedNumType = 0x90001; // a) - } - else - nMappedNumType = 0x00001; // a. - } - break; - case SVX_NUM_ROMAN_UPPER : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0xe0001; // (I) - else - nMappedNumType = 0xf0001; // I) - } - else - nMappedNumType = 0x70001; // I. - } - break; - case SVX_NUM_ROMAN_LOWER : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0x40001; // (i) - else - nMappedNumType = 0x50001; // i) - } - else - nMappedNumType = 0x60001; // i. - } - break; - case SVX_NUM_ARABIC : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0xc0001; // (1) - else - nMappedNumType = 0x20001; // 1) - } - else - { - if ( ! ( sSuffix.Len() + sPrefix.Len() ) ) - nMappedNumType = 0xd0001; // 1 - else - nMappedNumType = 0x30001; // 1. - } - } - break; - default: - break; - } - } - nParaFlags |= 0x2f; - nBulletFlags |= 6; - if ( mbIsBullet && bNumberingIsNumber ) - nBulletFlags |= 1; - } - } - } - } - } - nBulletOfs = nTextOfs + nBulletOfs; - if ( nBulletOfs < 0 ) - nBulletOfs = 0; -} - -void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue ) -{ - static String sNumberingLevel ( RTL_CONSTASCII_USTRINGPARAM( "NumberingLevel" ) ); - - ::com::sun::star::uno::Any aAny; - if ( GetPropertyValue( aAny, mXPropSet, sNumberingLevel, sal_True ) ) - { - if ( bGetPropStateValue ) - meBullet = GetPropertyState( mXPropSet, sNumberingLevel ); - nDepth = *( (sal_Int16*)aAny.getValue() ); - - if ( nDepth < 0 ) - { - mbIsBullet = sal_False; - nDepth = 0; - } - else - { - if ( nDepth > 4 ) - nDepth = 4; - mbIsBullet = sal_True; - } - } - else - { - nDepth = 0; - mbIsBullet = sal_False; - } - ImplGetNumberingLevel( rBuProv, nDepth, mbIsBullet, bGetPropStateValue ); - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTabStops" ) ), bGetPropStateValue ) ) - maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue(); - sal_Int16 eTextAdjust( ::com::sun::star::style::ParagraphAdjust_LEFT ); - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) ), bGetPropStateValue ) ) - aAny >>= eTextAdjust; - switch ( (::com::sun::star::style::ParagraphAdjust)eTextAdjust ) - { - case ::com::sun::star::style::ParagraphAdjust_CENTER : - mnTextAdjust = 1; - break; - case ::com::sun::star::style::ParagraphAdjust_RIGHT : - mnTextAdjust = 2; - break; - case ::com::sun::star::style::ParagraphAdjust_BLOCK : - mnTextAdjust = 3; - break; - default : - case ::com::sun::star::style::ParagraphAdjust_LEFT : - mnTextAdjust = 0; - break; - } - meTextAdjust = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaLineSpacing" ) ), bGetPropStateValue ) ) - { - ::com::sun::star::style::LineSpacing aLineSpacing - = *( (::com::sun::star::style::LineSpacing*)mAny.getValue() ); - switch ( aLineSpacing.Mode ) - { - case ::com::sun::star::style::LineSpacingMode::MINIMUM : - case ::com::sun::star::style::LineSpacingMode::LEADING : - case ::com::sun::star::style::LineSpacingMode::FIX : - mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) ); - break; - - case ::com::sun::star::style::LineSpacingMode::PROP : - default: - mnLineSpacing = (sal_Int16)( aLineSpacing.Height ); - break; - } - } - meLineSpacing = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaBottomMargin" ) ), bGetPropStateValue ) ) - { - double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1; - mnLineSpacingBottom = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) ); - } - meLineSpacingBottom = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTopMargin" ) ), bGetPropStateValue ) ) - { - double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1; - mnLineSpacingTop = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) ); - } - meLineSpacingTop = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsForbiddenRules" ) ), bGetPropStateValue ) ) - mAny >>= mbForbiddenRules; - meForbiddenRules = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsHangingPunctuation" ) ), bGetPropStateValue ) ) - mAny >>= mbParagraphPunctation; - meParagraphPunctation = ePropState; - - mnBiDi = 0; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ), bGetPropStateValue ) ) - { - sal_Int16 nWritingMode; - mAny >>= nWritingMode; - - SvxFrameDirection eWritingMode( (SvxFrameDirection)nWritingMode ); - if ( ( eWritingMode == FRMDIR_HORI_RIGHT_TOP ) - || ( eWritingMode == FRMDIR_VERT_TOP_RIGHT ) ) - { - mnBiDi = 1; - } - } - meBiDi = ePropState; -} - -void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj ) -{ - mnTextSize = rParagraphObj.mnTextSize; - mnTextAdjust = rParagraphObj.mnTextAdjust; - mnLineSpacing = rParagraphObj.mnLineSpacing; - mnLineSpacingTop = rParagraphObj.mnLineSpacingTop; - mnLineSpacingBottom = rParagraphObj.mnLineSpacingBottom; - mbFirstParagraph = rParagraphObj.mbFirstParagraph; - mbLastParagraph = rParagraphObj.mbLastParagraph; - mbParagraphPunctation = rParagraphObj.mbParagraphPunctation; - mbForbiddenRules = rParagraphObj.mbForbiddenRules; - mnBiDi = rParagraphObj.mnBiDi; - - ParagraphObj& rOther = const_cast<ParagraphObj&>(rParagraphObj); - for ( const void* pPtr = rOther.First(); pPtr; pPtr = rOther.Next() ) - Insert( new PortionObj( *(const PortionObj*)pPtr ), LIST_APPEND ); - - maTabStop = rParagraphObj.maTabStop; - bExtendedParameters = rParagraphObj.bExtendedParameters; - nParaFlags = rParagraphObj.nParaFlags; - nBulletFlags = rParagraphObj.nBulletFlags; - sPrefix = rParagraphObj.sPrefix; - sSuffix = rParagraphObj.sSuffix; - sGraphicUrl = rParagraphObj.sGraphicUrl; // String auf eine Graphic - aBuGraSize = rParagraphObj.aBuGraSize; - nNumberingType = rParagraphObj.nNumberingType; // in wirlichkeit ist dies ein SvxEnum - nHorzAdjust = rParagraphObj.nHorzAdjust; - nBulletColor = rParagraphObj.nBulletColor; - nBulletOfs = rParagraphObj.nBulletOfs; - nStartWith = rParagraphObj.nStartWith; // Start der nummerierung - nTextOfs = rParagraphObj.nTextOfs; - nBulletRealSize = rParagraphObj.nBulletRealSize; // GroessenVerhaeltnis in Proz - nDepth = rParagraphObj.nDepth; // aktuelle tiefe - cBulletId = rParagraphObj.cBulletId; // wenn Numbering Type == CharSpecial - aFontDesc = rParagraphObj.aFontDesc; - - bExtendedBulletsUsed = rParagraphObj.bExtendedBulletsUsed; - nBulletId = rParagraphObj.nBulletId; -} - -sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ) -{ - mnTextSize = 0; - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - mnTextSize += ((PortionObj*)pPtr)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize ); - return mnTextSize; -} - -ParagraphObj& ParagraphObj::operator=( const ParagraphObj& rParagraphObj ) -{ - if ( this != &rParagraphObj ) - { - ImplClear(); - ImplConstruct( rParagraphObj ); - } - return *this; -} - -// ----------------------------------------------------------------------- - -ImplTextObj::ImplTextObj( int nInstance ) -{ - mnRefCount = 1; - mnTextSize = 0; - mnInstance = nInstance; - mpList = new List; - mbHasExtendedBullets = FALSE; - mbFixedCellHeightUsed = FALSE; -} - -ImplTextObj::~ImplTextObj() -{ - for ( ParagraphObj* pPtr = (ParagraphObj*)mpList->First(); pPtr; pPtr = (ParagraphObj*)mpList->Next() ) - delete pPtr; - delete mpList; -} - -TextObj::TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & rXTextRef, - int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) -{ - mpImplTextObj = new ImplTextObj( nInstance ); - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > - aXTextParagraphEA( rXTextRef, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXTextParagraphEA.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > - aXTextParagraphE( aXTextParagraphEA->createEnumeration() ); - if ( aXTextParagraphE.is() ) - { - ParaFlags aParaFlags; - while ( aXTextParagraphE->hasMoreElements() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > aXParagraph; - ::com::sun::star::uno::Any aAny( aXTextParagraphE->nextElement() ); - if ( aAny >>= aXParagraph ) - { - if ( !aXTextParagraphE->hasMoreElements() ) - aParaFlags.bLastParagraph = TRUE; - ParagraphObj* pPara = new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv ); - mpImplTextObj->mbHasExtendedBullets |= pPara->bExtendedBulletsUsed; - mpImplTextObj->mpList->Insert( pPara, LIST_APPEND ); - aParaFlags.bFirstParagraph = FALSE; - } - } - } - } - ImplCalculateTextPositions(); -} - -TextObj::TextObj( const TextObj& rTextObj ) -{ - mpImplTextObj = rTextObj.mpImplTextObj; - mpImplTextObj->mnRefCount++; -} - -TextObj::~TextObj() -{ - if ( ! ( --mpImplTextObj->mnRefCount ) ) - delete mpImplTextObj; -} - -void TextObj::Write( SvStream* pStrm ) -{ - sal_uInt32 nSize, nPos = pStrm->Tell(); - *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0; - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - ((ParagraphObj*)pPtr)->Write( pStrm ); - nSize = pStrm->Tell() - nPos; - pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) ); - *pStrm << (sal_uInt32)( nSize - 8 ); - pStrm->SeekRel( nSize - 8 ); -} - -void TextObj::ImplCalculateTextPositions() -{ - mpImplTextObj->mnTextSize = 0; - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - mpImplTextObj->mnTextSize += ((ParagraphObj*)pPtr)->ImplCalculateTextPositions( mpImplTextObj->mnTextSize ); -} - -TextObj& TextObj::operator=( TextObj& rTextObj ) -{ - if ( this != &rTextObj ) - { - if ( ! ( --mpImplTextObj->mnRefCount ) ) - delete mpImplTextObj; - mpImplTextObj = rTextObj.mpImplTextObj; - mpImplTextObj->mnRefCount++; - } - return *this; -} - -void TextObj::WriteTextSpecInfo( SvStream* pStrm ) -{ - sal_uInt32 nCharactersLeft( Count() ); - if ( nCharactersLeft >= 1 ) - { - EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 ); - for ( ParagraphObj* pPtr = static_cast < ParagraphObj * >( First() ); nCharactersLeft && pPtr; pPtr = static_cast< ParagraphObj* >( Next() ) ) - { - for ( PortionObj* pPortion = static_cast< PortionObj* >( pPtr->First() ); nCharactersLeft && pPortion; pPortion = static_cast< PortionObj* >( pPtr->Next() ) ) - { - sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize; - sal_Int32 nFlags = 7; - nCharactersLeft -= nPortionSize; - *pStrm << static_cast< sal_uInt32 >( nPortionSize ) - << nFlags - << static_cast< sal_Int16 >( 1 ) // spellinfo -> needs rechecking - << static_cast< sal_Int16 >( MsLangId::convertLocaleToLanguageWithFallback( pPortion->meCharLocale ) ) - << static_cast< sal_Int16 >( 0 ); // alt language - } - } - if ( nCharactersLeft ) - *pStrm << nCharactersLeft << static_cast< sal_Int32 >( 1 ) << static_cast< sal_Int16 >( 1 ); - - } -} - -// ----------------------------------------------------------------------- - void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt ) { if ( !mbFontIndependentLineSpacing ) @@ -3096,7 +1181,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u if ( !mbEmptyPresObj ) { ParagraphObj* pPara; - TextObj aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this ); + TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this ); // leaving out EPP_TextCharsAtom w/o text - still write out // attribute info though @@ -3130,9 +1215,9 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u case 2 : { rOut << (sal_uInt32)( EPP_DateTimeMCAtom << 16 ) << (sal_uInt32)8 - << (sal_uInt32)( pFieldEntry->nFieldStartPos ) // TxtOffset auf TxtField; - << (sal_uInt8)( pFieldEntry->nFieldType & 0xff ) // Type - << (sal_uInt8)0 << (sal_uInt16)0; // PadBytes + << (sal_uInt32)( pFieldEntry->nFieldStartPos ) // TxtOffset auf TxtField; + << (sal_uInt8)( pFieldEntry->nFieldType & 0xff ) // Type + << (sal_uInt8)0 << (sal_uInt16)0; // PadBytes } break; case 3 : @@ -3174,9 +1259,9 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u rOut << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)24 << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16 - << (sal_uInt32)0 // soundref - << nHyperId // hyperlink id - << (sal_uInt8)4 // hyperlink action + << (sal_uInt32)0 // soundref + << nHyperId // hyperlink id + << (sal_uInt8)4 // hyperlink action << (sal_uInt8)0 // ole verb << (sal_uInt8)0 // jump << (sal_uInt8)0 // flags @@ -3248,7 +1333,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u } nParaFlags >>= 16; - sal_uInt32 nDefaultTabSize = ImplMapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width; + sal_uInt32 nDefaultTabSize = MapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width; sal_uInt32 nDefaultTabs = abs( maRect.GetWidth() ) / nDefaultTabSize; if ( nTabs ) nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize ); @@ -4038,7 +2123,7 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentat << nFlags << (sal_uInt32)nHyperLinkType; - if ( nAction == 2 ) // run program Action + if ( nAction == 2 ) // run program Action { sal_uInt16 i, nLen = aFile.Len(); rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) << (sal_uInt32)( nLen * 2 ); @@ -4104,7 +2189,7 @@ sal_Bool PPTWriter::ImplCreatePresentationPlaceholder( const sal_Bool bMasterPag aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ); SvMemoryStream aExtBu( 0x200, 0x200 ); - SvMemoryStream aClientTextBox( 0x200, 0x200 ); + SvMemoryStream aClientTextBox( 0x200, 0x200 ); ImplWriteTextStyleAtom( aClientTextBox, nStyleInstance, 0, NULL, aExtBu, &aPropOpt ); aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True ); @@ -4115,10 +2200,10 @@ sal_Bool PPTWriter::ImplCreatePresentationPlaceholder( const sal_Bool bMasterPag mpPptEscherEx->OpenContainer( ESCHER_ClientData ); mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom ); *mpStrm << (sal_uInt32)0 // PlacementID - << (sal_uInt8)nPlaceHolderId // PlaceHolderID - << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER ) + << (sal_uInt8)nPlaceHolderId // PlaceHolderID + << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER ) << (sal_uInt16)0; // padword - mpPptEscherEx->CloseContainer(); // ESCHER_ClientData + mpPptEscherEx->CloseContainer(); // ESCHER_ClientData /* if ( aExtBu.Tell() ) { @@ -4206,7 +2291,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a nGroups = GetGroupsClosed(); for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ; - if ( ImplGetShapeByIndex( GetCurrentGroupIndex(), TRUE ) ) + if ( GetShapeByIndex( GetCurrentGroupIndex(), TRUE ) ) { sal_Bool bIsSound; sal_Bool bMediaClickAction = sal_False; @@ -4276,8 +2361,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "BoundRect" ) ) ) ) { ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)mAny.getValue() ); - maPosition = ImplMapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) ); - maSize = ImplMapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) ); + maPosition = MapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) ); + maSize = MapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) ); maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) ); } mType = "drawing.dontknow"; @@ -4295,7 +2380,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a rtl::OUString sCustomShapeType; MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( mXShape, nMirrorFlags, sCustomShapeType ); if ( sCustomShapeType.equalsAscii( "col-502ad400" ) || sCustomShapeType.equalsAscii( "col-60da8460" ) ) - { // sj: creating metafile for customshapes that can't be saved to ms format properly + { // sj: creating metafile for customshapes that can't be saved to ms format properly ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer ); if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) ) { @@ -4304,8 +2389,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( pObj ) { Rectangle aBound = pObj->GetCurrentBoundRect(); - maPosition = ImplMapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) ); - maSize = ImplMapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) ); + maPosition = MapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) ); + maSize = MapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) ); maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) ); mnAngle = 0; } @@ -4330,7 +2415,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CornerRadius" ) ) ) ) { mAny >>= nRadius; - nRadius = ImplMapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width; + nRadius = MapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width; } if ( nRadius ) { @@ -4449,7 +2534,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } break; } - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); if ( bNeedText && ImplGetText() ) @@ -4506,7 +2591,6 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a << (sal_uInt32)4 // index to the persist table << (sal_uInt32)0x0012de00; - ::com::sun::star::awt::Size aSize; String aControlName; SvStorageRef xTemp( new SvStorage( new SvMemoryStream(), TRUE ) ); @@ -4593,7 +2677,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False ) continue; - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); @@ -4608,7 +2692,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a { ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_LINE, sal_False, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); if ( ImplGetText() ) @@ -4643,7 +2727,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateFillProperties( mXPropSet, sal_True ); @@ -4662,7 +2746,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateLineProperties( mXPropSet, sal_False ); @@ -4681,7 +2765,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateLineProperties( mXPropSet, sal_False ); @@ -4700,7 +2784,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateFillProperties( mXPropSet, sal_True ); @@ -4782,7 +2866,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a bIsTitlePossible = FALSE; ImplGetText(); - TextObj aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this ); + TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this ); if ( ePageType == MASTER ) { if ( mnTextSize ) @@ -4797,8 +2881,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a aPropertyOptions.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 ); aPropertyOptions.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 ); aPropertyOptions.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle ); -// aPropertyOptions.AddOpt( ESCHER_Prop_fillColor, nFillColor ); -// aPropertyOptions.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor ); +// aPropertyOptions.AddOpt( ESCHER_Prop_fillColor, nFillColor ); +// aPropertyOptions.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor ); aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 ); aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 ); aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 ); @@ -4878,7 +2962,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ) { ImplGetText(); - TextObj aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this ); + TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this ); if ( ePageType == MASTER ) { nPrevTextStyle = EPP_TEXTSTYLE_TITLE; @@ -4890,8 +2974,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a EscherPropertyContainer aPropOpt2; aPropOpt2.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 ); aPropOpt2.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 ); -// aPropOpt2.AddOpt( ESCHER_Prop_fillColor, nFillColor ); -// aPropOpt2.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor ); +// aPropOpt2.AddOpt( ESCHER_Prop_fillColor, nFillColor ); +// aPropOpt2.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor ); aPropOpt2.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 ); aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 ); aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 ); @@ -5031,14 +3115,14 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a *mpExEmbed << (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) ) << (sal_uInt32)24 - << (sal_uInt32)nAspect // Aspect + << (sal_uInt32)nAspect // Aspect << (sal_uInt32)0 << (sal_uInt32)mnExEmbed // index to the persist table << (sal_uInt32)0 // subtype << (sal_uInt32)0 << (sal_uInt32)0x0012b600; -// PPTWriter::WriteCString( *mpExEmbed, "Photo Editor Photo", 1 ); +// PPTWriter::WriteCString( *mpExEmbed, "Photo Editor Photo", 1 ); // PPTWriter::WriteCString( *mpExEmbed, "MSPhotoEd.3", 2 ); // PPTWriter::WriteCString( *mpExEmbed, "Microsoft Photo Editor 3.0 Photo", 3 ); @@ -5130,7 +3214,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a sal_uInt32 nRefId = ++mnExEmbed; *mpExEmbed << (sal_uInt16)0xf - << (sal_uInt16)EPP_ExMCIMovie // PPT_PST_ExAviMovie + << (sal_uInt16)EPP_ExMCIMovie // PPT_PST_ExAviMovie << (sal_uInt32)0; sal_uInt32 nSize, nStart = mpExEmbed->Tell(); *mpExEmbed << (sal_uInt16)0 @@ -5141,14 +3225,13 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a << (sal_uInt16)EPP_ExVideo << (sal_uInt32)0; - *mpExEmbed << (sal_uInt16)0 + *mpExEmbed << (sal_uInt16)0 << (sal_uInt16)EPP_ExMediaAtom << (sal_uInt32)8 << nRefId << (sal_uInt16)0 << (sal_uInt16)0x435; - sal_uInt16 i, nStringLen = (sal_uInt16)aMediaURL.getLength(); *mpExEmbed << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nStringLen * 2 ); for ( i = 0; i < nStringLen; i++ ) @@ -5158,10 +3241,10 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } nSize = mpExEmbed->Tell() - nStart; mpExEmbed->SeekRel( - ( (sal_Int32)nSize + 4 ) ); - *mpExEmbed << nSize; // size of PPT_PST_ExMCIMovie + *mpExEmbed << nSize; // size of PPT_PST_ExMCIMovie mpExEmbed->SeekRel( 0x10 ); nSize -= 20; - *mpExEmbed << nSize; // PPT_PST_ExMediaAtom + *mpExEmbed << nSize; // PPT_PST_ExMediaAtom mpExEmbed->SeekRel( nSize ); if ( !pClientData ) @@ -5291,7 +3374,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a { sal_uInt32 nTextType = EPP_TEXTTYPE_Body; if ( mnTextStyle == EPP_TEXTSTYLE_BODY ) - { + { if ( bSecOutl ) nTextType = EPP_TEXTTYPE_HalfBody; else if ( mType == "presentation.Subtitle" ) @@ -5452,43 +3535,11 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a // ----------------------------------------------------------------------- -::com::sun::star::awt::Point PPTWriter::ImplMapPoint( const ::com::sun::star::awt::Point& rPoint ) -{ - Point aRet( OutputDevice::LogicToLogic( Point( rPoint.X, rPoint.Y ), maMapModeSrc, maMapModeDest ) ); - return ::com::sun::star::awt::Point( aRet.X(), aRet.Y() ); -} - -// ----------------------------------------------------------------------- - -::com::sun::star::awt::Size PPTWriter::ImplMapSize( const ::com::sun::star::awt::Size& rSize ) -{ - Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) ); - - if ( !aRetSize.Width() ) - aRetSize.Width()++; - if ( !aRetSize.Height() ) - aRetSize.Height()++; - return ::com::sun::star::awt::Size( aRetSize.Width(), aRetSize.Height() ); -} - -// ----------------------------------------------------------------------- - -Rectangle PPTWriter::ImplMapRectangle( const ::com::sun::star::awt::Rectangle& rRect ) -{ - ::com::sun::star::awt::Point aPoint( rRect.X, rRect.Y ); - ::com::sun::star::awt::Size aSize( rRect.Width, rRect.Height ); - ::com::sun::star::awt::Point aP( ImplMapPoint( aPoint ) ); - ::com::sun::star::awt::Size aS( ImplMapSize( aSize ) ); - return Rectangle( Point( aP.X, aP.Y ), Size( aS.Width, aS.Height ) ); -} - -// ----------------------------------------------------------------------- - struct CellBorder { - sal_Int32 mnPos; // specifies the distance to the top/left position of the table - sal_Int32 mnLength; - table::BorderLine maCellBorder; + sal_Int32 mnPos; // specifies the distance to the top/left position of the table + sal_Int32 mnLength; + table::BorderLine maCellBorder; CellBorder() : mnPos ( 0 ), mnLength( 0 ){}; }; @@ -5508,16 +3559,16 @@ void PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 n aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0xa0008 ); aPropOptSp.AddOpt( ESCHER_Prop_fshadowObscured, 0x20000 ); - sal_uInt32 nBorderColor = pCellBorder->maCellBorder.Color & 0xff00; // green - nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color ) << 16; // red - nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color >> 16 ); // blue + sal_uInt32 nBorderColor = pCellBorder->maCellBorder.Color & 0xff00; // green + nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color ) << 16; // red + nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color >> 16 ); // blue aPropOptSp.AddOpt( ESCHER_Prop_lineColor, nBorderColor ); aPropOptSp.AddOpt( ESCHER_Prop_lineWidth, nLineWidth * 360 ); aPropOptSp.AddOpt( ESCHER_Prop_fc3DLightFace, 0x80000 ); aPropOptSp.Commit( *mpStrm ); mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor ); - *mpStrm << nX1 + *mpStrm << nX1 << nY1 << nX2 << nY2; @@ -5543,18 +3594,18 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc mpPptEscherEx->OpenContainer( ESCHER_SpgrContainer ); mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 ); - *mpStrm << (INT32)maRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden + *mpStrm << (INT32)maRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden << (INT32)maRect.Top() << (INT32)maRect.Right() << (INT32)maRect.Bottom(); sal_uInt32 nShapeId = mpPptEscherEx->GenerateShapeId(); - mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | Patriarch + mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | Patriarch aSolverContainer.AddShape( rXShape, nShapeId ); EscherPropertyContainer aPropOpt2; try { - static const rtl::OUString sModel( RTL_CONSTASCII_USTRINGPARAM ( "Model" ) ); + static const rtl::OUString sModel( RTL_CONSTASCII_USTRINGPARAM ( "Model" ) ); static const rtl::OUString sWidth( RTL_CONSTASCII_USTRINGPARAM ( "Width" ) ); static const rtl::OUString sHeight( RTL_CONSTASCII_USTRINGPARAM ( "Height" ) ); @@ -5570,14 +3621,14 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns; std::vector< std::pair< sal_Int32, sal_Int32 > > aRows; - awt::Point aPosition( ImplMapPoint( rXShape->getPosition() ) ); + awt::Point aPosition( MapPoint( rXShape->getPosition() ) ); sal_uInt32 nPosition = aPosition.X; for ( sal_Int32 x = 0; x < nColumnCount; x++ ) { uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sWidth ) >>= aS.Width; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) ); nPosition += aM.Width; } @@ -5588,7 +3639,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sHeight ) >>= aS.Height; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) ); nPosition += aM.Height; } @@ -5618,7 +3669,6 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc << (sal_Int16)( maRect.GetHeight() + maRect.Top() ); mpPptEscherEx->CloseContainer(); - uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW ); for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ ) { @@ -5673,7 +3723,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc aPropOptSp.Commit( *mpStrm ); mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor ); - *mpStrm << nLeft + *mpStrm << nLeft << nTop << nRight << nBottom; @@ -5690,28 +3740,28 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc static const rtl::OUString sTopBorder( String( RTL_CONSTASCII_USTRINGPARAM( "TopBorder" ) ) ); static const rtl::OUString sBottomBorder( String( RTL_CONSTASCII_USTRINGPARAM( "BottomBorder" ) ) ); static const rtl::OUString sLeftBorder( String( RTL_CONSTASCII_USTRINGPARAM( "LeftBorder" ) ) ); - static const rtl::OUString sRightBorder( String( RTL_CONSTASCII_USTRINGPARAM( "RightBorder" ) ) ); - static const rtl::OUString sDiagonalTLBR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalTLBR" ) ); - static const rtl::OUString sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) ); + static const rtl::OUString sRightBorder( String( RTL_CONSTASCII_USTRINGPARAM( "RightBorder" ) ) ); + static const rtl::OUString sDiagonalTLBR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalTLBR" ) ); + static const rtl::OUString sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) ); // creating horz lines - sal_Int32 nYPos = ImplMapPoint( rXShape->getPosition() ).Y; + sal_Int32 nYPos = MapPoint( rXShape->getPosition() ).Y; for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ ) { - sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X; + sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X; std::vector< CellBorder > vCellBorders; for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ ) { uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nColumn ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sWidth ) >>= aS.Width; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); CellBorder aCellBorder; aCellBorder.mnPos = nXPos; aCellBorder.mnLength = aM.Width; if ( nLine < xRows->getCount() ) - { // top border + { // top border uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; @@ -5719,7 +3769,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc aCellBorder.maCellBorder = aBorderLine; } if ( nLine ) - { // bottom border + { // bottom border uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine - 1 ), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; @@ -5741,29 +3791,29 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nLine ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sHeight ) >>= aS.Height; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); nYPos += aM.Height; } } // creating vertical lines - sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X; + sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X; for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ ) { - nYPos = ImplMapPoint( rXShape->getPosition() ).Y; + nYPos = MapPoint( rXShape->getPosition() ).Y; std::vector< CellBorder > vCellBorders; for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ ) { uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nRow ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sHeight ) >>= aS.Height; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); CellBorder aCellBorder; aCellBorder.mnPos = nYPos; aCellBorder.mnLength = aM.Height; if ( nLine < xColumns->getCount() ) - { // left border + { // left border uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; @@ -5771,7 +3821,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc aCellBorder.maCellBorder = aBorderLine; } if ( nLine ) - { // right border + { // right border uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine - 1, nRow ), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; @@ -5793,7 +3843,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nLine ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sWidth ) >>= aS.Width; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); nXPos += aM.Width; } } @@ -5806,4 +3856,44 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc mpPptEscherEx->CloseContainer(); } +//---------------------------------------------------------------------------------------------------------- + +void TextObjBinary::Write( SvStream* pStrm ) +{ + sal_uInt32 nSize, nPos = pStrm->Tell(); + *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0; + for ( void* pPtr = First(); pPtr; pPtr = Next() ) + ((ParagraphObj*)pPtr)->Write( pStrm ); + nSize = pStrm->Tell() - nPos; + pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) ); + *pStrm << (sal_uInt32)( nSize - 8 ); + pStrm->SeekRel( nSize - 8 ); +} + +void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm ) +{ + sal_uInt32 nCharactersLeft( Count() ); + if ( nCharactersLeft >= 1 ) + { + EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 ); + for ( ParagraphObj* pPtr = static_cast < ParagraphObj * >( First() ); nCharactersLeft && pPtr; pPtr = static_cast< ParagraphObj* >( Next() ) ) + { + for ( PortionObj* pPortion = static_cast< PortionObj* >( pPtr->First() ); nCharactersLeft && pPortion; pPortion = static_cast< PortionObj* >( pPtr->Next() ) ) + { + sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize; + sal_Int32 nFlags = 7; + nCharactersLeft -= nPortionSize; + *pStrm << static_cast< sal_uInt32 >( nPortionSize ) + << nFlags + << static_cast< sal_Int16 >( 1 ) // spellinfo -> needs rechecking + << static_cast< sal_Int16 >( MsLangId::convertLocaleToLanguageWithFallback( pPortion->meCharLocale ) ) + << static_cast< sal_Int16 >( 0 ); // alt language + } + } + if ( nCharactersLeft ) + *pStrm << nCharactersLeft << static_cast< sal_Int32 >( 1 ) << static_cast< sal_Int16 >( 1 ); + + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/eppt/makefile.mk b/sd/source/filter/eppt/makefile.mk index 76b13e1ab..2a911038e 100644 --- a/sd/source/filter/eppt/makefile.mk +++ b/sd/source/filter/eppt/makefile.mk @@ -41,13 +41,16 @@ VISIBILITY_HIDDEN=TRUE NOOPTFILES= $(SLO)$/epptso.obj .ENDIF -SLOFILES = $(SLO)$/eppt.obj \ - $(SLO)$/epptso.obj \ - $(SLO)$/escherex.obj \ +SLOFILES = $(SLO)$/eppt.obj \ + $(SLO)$/epptso.obj \ + $(SLO)$/escherex.obj \ $(SLO)$/pptexanimations.obj \ $(SLO)$/pptexsoundcollection.obj \ $(SLO)$/pptx-epptbase.obj \ - $(SLO)$/pptx-epptooxml.obj + $(SLO)$/pptx-epptooxml.obj \ + $(SLO)$/pptx-stylesheet.obj \ + $(SLO)$/pptx-grouptable.obj \ + $(SLO)$/pptx-text.obj # --- Targets -------------------------------------------------------------- |