incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1391088 - /incubator/ooo/trunk/main/svx/source/xoutdev/_xoutbmp.cxx
Date Thu, 27 Sep 2012 16:31:38 GMT
Author: alg
Date: Thu Sep 27 16:31:38 2012
New Revision: 1391088

URL: http://svn.apache.org/viewvc?rev=1391088&view=rev
Log:
#121128# added missing original data export for SVG in XOutBitmap::WriteGraphic

Modified:
    incubator/ooo/trunk/main/svx/source/xoutdev/_xoutbmp.cxx

Modified: incubator/ooo/trunk/main/svx/source/xoutdev/_xoutbmp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/xoutdev/_xoutbmp.cxx?rev=1391088&r1=1391087&r2=1391088&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/xoutdev/_xoutbmp.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/xoutdev/_xoutbmp.cxx Thu Sep 27 16:31:38 2012
@@ -343,43 +343,74 @@ sal_uInt16 XOutBitmap::WriteGraphic( con
             aURL.setBase( aName );
 		}
 
-		if( ( nFlags & XOUTBMP_USE_NATIVE_IF_POSSIBLE ) &&
-			!( nFlags & XOUTBMP_MIRROR_HORZ ) &&
-			!( nFlags & XOUTBMP_MIRROR_VERT ) &&
-			( rGraphic.GetType() != GRAPHIC_GDIMETAFILE ) && rGraphic.IsLink() )
-		{
-			// try to write native link
-			const GfxLink aGfxLink( ( (Graphic&) rGraphic ).GetLink() );
-
-			switch( aGfxLink.GetType() )
-			{
-				case( GFX_LINK_TYPE_NATIVE_GIF ): aExt = FORMAT_GIF; break;
-				case( GFX_LINK_TYPE_NATIVE_JPG ): aExt = FORMAT_JPG; break;
-				case( GFX_LINK_TYPE_NATIVE_PNG ): aExt = FORMAT_PNG; break;
+        // #121128# use shortcut to write SVG data in original form (if possible)
+        const SvgDataPtr aSvgDataPtr(rGraphic.getSvgData());
 
-				default:
-				break;
-			}
+        if(aSvgDataPtr.get() 
+            && aSvgDataPtr->getSvgDataArrayLength()
+            && rFilterName.EqualsIgnoreCaseAscii("svg"))
+        {
+            if(!(nFlags & XOUTBMP_DONT_ADD_EXTENSION))
+            {
+                aURL.setExtension(rFilterName);
+            }
+
+            rFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
+            SfxMedium aMedium(aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_WRITE|STREAM_SHARE_DENYNONE|STREAM_TRUNC,
true);
+            SvStream* pOStm = aMedium.GetOutStream();
+
+            if(pOStm)
+            {
+                pOStm->Write(aSvgDataPtr->getSvgDataArray().get(), aSvgDataPtr->getSvgDataArrayLength());
+                aMedium.Commit();
+
+                if(!aMedium.GetError())
+                {
+                    nErr = GRFILTER_OK;
+                }
+            }
+        }
 
-			if( aExt.Len() )
-			{
-                if( 0 == (nFlags & XOUTBMP_DONT_ADD_EXTENSION))
-                    aURL.setExtension( aExt );
-				rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
+		if( GRFILTER_OK != nErr )
+		{
+		    if( ( nFlags & XOUTBMP_USE_NATIVE_IF_POSSIBLE ) &&
+			    !( nFlags & XOUTBMP_MIRROR_HORZ ) &&
+			    !( nFlags & XOUTBMP_MIRROR_VERT ) &&
+			    ( rGraphic.GetType() != GRAPHIC_GDIMETAFILE ) && rGraphic.IsLink() )
+		    {
+			    // try to write native link
+			    const GfxLink aGfxLink( ( (Graphic&) rGraphic ).GetLink() );
+
+			    switch( aGfxLink.GetType() )
+			    {
+				    case( GFX_LINK_TYPE_NATIVE_GIF ): aExt = FORMAT_GIF; break;
+				    case( GFX_LINK_TYPE_NATIVE_JPG ): aExt = FORMAT_JPG; break;
+				    case( GFX_LINK_TYPE_NATIVE_PNG ): aExt = FORMAT_PNG; break;
+
+				    default:
+				    break;
+			    }
 
-				SfxMedium	aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_SHARE_DENYNONE
| STREAM_TRUNC, sal_True );
-				SvStream*	pOStm = aMedium.GetOutStream();
+			    if( aExt.Len() )
+			    {
+                    if( 0 == (nFlags & XOUTBMP_DONT_ADD_EXTENSION))
+                        aURL.setExtension( aExt );
+				    rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
 
-				if( pOStm && aGfxLink.GetDataSize() && aGfxLink.GetData() )
-				{
-					pOStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() );
-					aMedium.Commit();
+				    SfxMedium	aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_SHARE_DENYNONE
| STREAM_TRUNC, sal_True );
+				    SvStream*	pOStm = aMedium.GetOutStream();
 
-					if( !aMedium.GetError() )
-						nErr = GRFILTER_OK;
-				}
-			}
-		}
+				    if( pOStm && aGfxLink.GetDataSize() && aGfxLink.GetData() )
+				    {
+					    pOStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() );
+					    aMedium.Commit();
+
+					    if( !aMedium.GetError() )
+						    nErr = GRFILTER_OK;
+				    }
+			    }
+		    }
+        }
 
 		if( GRFILTER_OK != nErr )
 		{



Mime
View raw message