ooo-build r12326 - in branches/ooo-build-2-4: . patches/src680



Author: thorstenb
Date: Thu Apr 24 23:36:23 2008
New Revision: 12326
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12326&view=rev

Log:
	* patches/src680/apply: added svx-export-image-links.diff for SUSE
	and Gentoo flavor

	* patches/src680/svx-export-image-links.diff: make the escher
	export deal with linked graphics correctly - writes out link url
	and appropriate flags



Added:
   branches/ooo-build-2-4/patches/src680/svx-export-image-links.diff
Modified:
   branches/ooo-build-2-4/ChangeLog
   branches/ooo-build-2-4/patches/src680/apply

Modified: branches/ooo-build-2-4/patches/src680/apply
==============================================================================
--- branches/ooo-build-2-4/patches/src680/apply	(original)
+++ branches/ooo-build-2-4/patches/src680/apply	Thu Apr 24 23:36:23 2008
@@ -48,7 +48,7 @@
 SUSE-10.1 : NovellBase, BerkeleyDB43
 SUSE-10.2 : NovellBase, BerkeleyDB43, EMFPlus
 SUSE-10.3 : NovellBase, BerkeleyDB43, EMFPlus
-SUSE      : NovellBase, BerkeleyDB43, Gcc43, EMFPlus, TransparentPrinting
+SUSE      : NovellBase, BerkeleyDB43, Gcc43, EMFPlus, TransparentPrinting, PptExport
 SUSE-reduced:NovellBase,BerkeleyDB43, ReducedDefaults
 # Debian
 DebianBase : LinuxCommon, DebianBaseOnly, Lockdown, GCCSTL, CalcSolver, BerkeleyDB43, Split, PostgreSQL
@@ -89,7 +89,7 @@
 openmamba: LinuxCommon, GlobalDesktopFiles
 #Gentoo
 GentooBase : LinuxCommon, GentooOnly, NotDebian, Lockdown, CalcSolver, CairoFonts, BerkeleyDB43, Gcc43
-GentooUnstable: GentooBase, GentooExperimental, TransparentPrinting
+GentooUnstable: GentooBase, GentooExperimental, TransparentPrinting, PptExport
 Gentoo : GentooBase
 Gentoo64: GentooBase
 # rPath Linux
@@ -2158,6 +2158,11 @@
 # adds fixes for printing transparent content
 vcl-transparent-printing.diff, thorsten
 
+[ PptExport ]
+# adds export for linked graphics to ppt - might break ppt export for
+# some obscure MSO versions
+svx-export-image-links.diff, n#283265, i#88713, thorsten
+
 [ IntegrateExtensions ]
 scp2_build_extensions.diff
 scp2_makefile_extensions.diff

Added: branches/ooo-build-2-4/patches/src680/svx-export-image-links.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4/patches/src680/svx-export-image-links.diff	Thu Apr 24 23:36:23 2008
@@ -0,0 +1,256 @@
+--- svx/source/msfilter/escherex.cxx	18 Mar 2008 23:42:22 -0000	1.75
++++ svx/source/msfilter/escherex.cxx	24 Apr 2008 23:26:26 -0000
+@@ -1330,10 +1330,12 @@ sal_Bool EscherPropertyContainer::Create
+ 
+     sal_Bool        bMirrored = sal_False;
+     sal_Bool        bRotate   = sal_True;
++    sal_uInt16      nAngle    = 0;
+     GraphicAttr*    pGraphicAttr = NULL;
+     GraphicObject   aGraphicObject;
+     String          aGraphicUrl;
+     ByteString      aUniqueId;
++    bool            bIsGraphicMtf(false);
+ 
+     ::com::sun::star::drawing::BitmapMode   eBitmapMode( ::com::sun::star::drawing::BitmapMode_NO_REPEAT );
+     ::com::sun::star::uno::Any aAny;
+@@ -1358,6 +1360,7 @@ sal_Bool EscherPropertyContainer::Create
+                 {
+                     aGraphicObject = aGraphic;
+                     aUniqueId = aGraphicObject.GetUniqueID();
++                    bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+                 }
+             }
+         }
+@@ -1373,6 +1376,7 @@ sal_Bool EscherPropertyContainer::Create
+                     Graphic     aGraphic( aBitmapEx );
+                     aGraphicObject = aGraphic;
+                     aUniqueId = aGraphicObject.GetUniqueID();
++                    bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+                 }
+             }
+         }
+@@ -1440,9 +1444,27 @@ sal_Bool EscherPropertyContainer::Create
+                     }
+                     eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT;
+                     aUniqueId = aGraphicObject.GetUniqueID();
++                    bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+                 }
+             }
+         }
++
++        if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsMirrored" ) ), sal_True ) )
++            aAny >>= bMirrored;
++
++        if ( bCreateFillBitmap && bFillBitmapModeAllowed )
++        {
++            if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapMode" ) ), sal_True ) )
++                aAny >>= eBitmapMode;
++        }
++        else
++        {
++            nAngle = bRotate && EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
++                                                                             String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True )
++                ? (sal_uInt16)( ( *((sal_Int32*)aAny.getValue() ) ) + 5 ) / 10
++                : 0;
++        }
++
+         if ( aGraphicUrl.Len() )
+         {
+             String aVndUrl( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+@@ -1455,101 +1477,125 @@ sal_Bool EscherPropertyContainer::Create
+             }
+             else
+             {
++                // externally, linked graphic? convert to embedded
++                // one, if transformations are needed. this is because
++                // everything < msoxp cannot even handle rotated
++                // bitmaps.
++                // And check whether the graphic link target is
++                // actually supported by mso.
+                 INetURLObject   aTmp( aGraphicUrl );
+-                SvStream* pIn = ::utl::UcbStreamHelper::CreateStream(
+-                    aTmp.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+-                if ( pIn )
++                GraphicDescriptor aDescriptor(aTmp);
++                aDescriptor.Detect();
++                const USHORT nFormat = aDescriptor.GetFileFormat();
++
++                // can MSO handle it?
++                if ( bMirrored || nAngle || 
++                     (nFormat != GFF_BMP && 
++                      nFormat != GFF_GIF &&
++                      nFormat != GFF_JPG &&
++                      nFormat != GFF_PNG &&
++                      nFormat != GFF_TIF &&
++                      nFormat != GFF_PCT &&
++                      nFormat != GFF_WMF &&
++                      nFormat != GFF_EMF) )
+                 {
+-                    Graphic aGraphic;
+-                    sal_uInt32 nErrCode = GraphicConverter::Import( *pIn, aGraphic );
+-                    if ( nErrCode == ERRCODE_NONE )
++                    SvStream* pIn = ::utl::UcbStreamHelper::CreateStream(
++                        aTmp.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
++                    if ( pIn )
+                     {
+-                        aGraphicObject = aGraphic;
+-                        aUniqueId = aGraphicObject.GetUniqueID();
++                        Graphic aGraphic;
++                        sal_uInt32 nErrCode = GraphicConverter::Import( *pIn, aGraphic );
++                        
++                        if ( nErrCode == ERRCODE_NONE )
++                        {
++                            // no.
++                            aGraphicObject = aGraphic;
++                            aUniqueId = aGraphicObject.GetUniqueID();
++                        }
++                        // else: simply keep the graphic link
++                        delete pIn;
+                     }
+-                    delete pIn;
+                 }
+             }
+         }
+-        if ( aUniqueId.Len() )
+-        {
+-            if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsMirrored" ) ), sal_True ) )
+-                aAny >>= bMirrored;
+ 
+-            if ( bCreateFillBitmap && bFillBitmapModeAllowed )
+-            {
+-                if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapMode" ) ), sal_True ) )
+-                    aAny >>= eBitmapMode;
+-            }
+-            else
++        if ( aGraphicUrl.Len() || aUniqueId.Len() )
++        {
++            if ( bMirrored || nAngle )
+             {
+-                sal_uInt16 nAngle = bRotate && EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+-                                        String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True )
+-                                    ? (sal_uInt16)( ( *((sal_Int32*)aAny.getValue() ) ) + 5 ) / 10
+-                                    : 0;
+-
+-                if ( bMirrored || nAngle )
++                pGraphicAttr = new GraphicAttr;
++                if ( bMirrored )
++                    pGraphicAttr->SetMirrorFlags( BMP_MIRROR_HORZ );
++                if ( bIsGraphicMtf )
++                    AddOpt( ESCHER_Prop_Rotation, ( ( ((sal_Int32)nAngle << 16 ) / 10 ) + 0x8000 ) &~ 0xffff );
++                else
+                 {
+-                    pGraphicAttr = new GraphicAttr;
+-                    if ( bMirrored )
+-                        pGraphicAttr->SetMirrorFlags( BMP_MIRROR_HORZ );
+-                    GraphicObject aTmpGraphicObject( aUniqueId );
+-                    if ( aTmpGraphicObject.GetType() == GRAPHIC_GDIMETAFILE )
+-                        AddOpt( ESCHER_Prop_Rotation, ( ( ((sal_Int32)nAngle << 16 ) / 10 ) + 0x8000 ) &~ 0xffff );
+-                    else
++                    pGraphicAttr->SetRotation( nAngle );
++                    if ( nAngle && pShapeBoundRect )   // up to xp ppoint does not rotate bitmaps !
+                     {
+-                        pGraphicAttr->SetRotation( nAngle );
+-                        if ( nAngle && pShapeBoundRect )   // up to xp ppoint does not rotate bitmaps !
+-                        {
+-                            Polygon aPoly( *pShapeBoundRect );
+-                            aPoly.Rotate( pShapeBoundRect->TopLeft(), nAngle );
+-                            *pShapeBoundRect = aPoly.GetBoundRect();
+-                            bSuppressRotation = sal_True;
+-                        }
++                        Polygon aPoly( *pShapeBoundRect );
++                        aPoly.Rotate( pShapeBoundRect->TopLeft(), nAngle );
++                        *pShapeBoundRect = aPoly.GetBoundRect();
++                        bSuppressRotation = sal_True;
+                     }
+                 }
+             }
++
+             if ( eBitmapMode == ::com::sun::star::drawing::BitmapMode_REPEAT )
+                 AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture );
+             else
+                 AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+ 
+-            if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
+-            {
+-                Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
+-
+-				sal_uInt32 nBlibId = 0;
+-				if ( aUniqueId.Len() )
+-					nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, NULL, pGraphicAttr );
+-				if ( nBlibId )
+-				{
+-					if ( bCreateFillBitmap )
+-						AddOpt( ESCHER_Prop_fillBlip, nBlibId, sal_True );
+-					else
+-					{
+-						AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
+-						ImplCreateGraphicAttributes( rXPropSet, nBlibId, bCreateCroppingAttributes );
+-					}
+-					bRetValue = sal_True;
+-				}
+-			}
+-            else
++            if ( aUniqueId.Len() )
+             {
+-                EscherGraphicProvider aProvider;
+-                SvMemoryStream aMemStrm;
+-                Rectangle aRect;
++                // write out embedded graphic
++                if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
++                {
++                    Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
+ 
+-                if ( aUniqueId.Len() && aProvider.GetBlibID( aMemStrm, aUniqueId, aRect, NULL, pGraphicAttr ) )
++                    sal_uInt32 nBlibId = 0;
++                    nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, NULL, pGraphicAttr );
++                    if ( nBlibId )
++                    {
++                        if ( bCreateFillBitmap )
++                            AddOpt( ESCHER_Prop_fillBlip, nBlibId, sal_True );
++                        else
++                        {
++                            AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
++                            ImplCreateGraphicAttributes( rXPropSet, nBlibId, bCreateCroppingAttributes );
++                        }
++                        bRetValue = sal_True;
++                    }
++                }
++                else
+                 {
+-                    // grab BLIP from stream and insert directly as complex property
+-                    // ownership of stream memory goes to complex property
+-                    aMemStrm.ObjectOwnsMemory( FALSE );
+-                    sal_uInt8* pBuf = (sal_uInt8*) aMemStrm.GetData();
+-                    sal_uInt32 nSize = aMemStrm.Seek( STREAM_SEEK_TO_END );
+-                    AddOpt( ESCHER_Prop_fillBlip, sal_True, nSize, pBuf, nSize );
+-                    bRetValue = sal_True;
++                    EscherGraphicProvider aProvider;
++                    SvMemoryStream aMemStrm;
++                    Rectangle aRect;
++
++                    if ( aProvider.GetBlibID( aMemStrm, aUniqueId, aRect, NULL, pGraphicAttr ) )
++                    {
++                        // grab BLIP from stream and insert directly as complex property
++                        // ownership of stream memory goes to complex property
++                        aMemStrm.ObjectOwnsMemory( FALSE );
++                        sal_uInt8* pBuf = (sal_uInt8*) aMemStrm.GetData();
++                        sal_uInt32 nSize = aMemStrm.Seek( STREAM_SEEK_TO_END );
++                        AddOpt( ESCHER_Prop_fillBlip, sal_True, nSize, pBuf, nSize );
++                        bRetValue = sal_True;
++                    }
+                 }
+             }
++            // write out link to graphic
++            else
++            {
++                OSL_ASSERT(aGraphicUrl.Len());
++                
++                AddOpt( ESCHER_Prop_pibName, aGraphicUrl );
++                sal_uInt32	nPibFlags=0;
++                GetOpt( ESCHER_Prop_pibFlags, nPibFlags );
++                AddOpt( ESCHER_Prop_pibFlags, 
++                        ESCHER_BlipFlagLinkToFile|ESCHER_BlipFlagFile|ESCHER_BlipFlagDoNotSave | nPibFlags );
++            }
+         }
+     }
+     delete pGraphicAttr;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]