You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2011/12/19 13:03:43 UTC

svn commit: r1220703 - in /incubator/ooo/branches/alg/svgreplacement/main/svtools/source: filter/filter.cxx graphic/descriptor.cxx graphic/provider.cxx

Author: alg
Date: Mon Dec 19 12:03:43 2011
New Revision: 1220703

URL: http://svn.apache.org/viewvc?rev=1220703&view=rev
Log:
svg: Added MimeType support for Svg, save picture now saves original Svg

Modified:
    incubator/ooo/branches/alg/svgreplacement/main/svtools/source/filter/filter.cxx
    incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/descriptor.cxx
    incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/provider.cxx

Modified: incubator/ooo/branches/alg/svgreplacement/main/svtools/source/filter/filter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svtools/source/filter/filter.cxx?rev=1220703&r1=1220702&r2=1220703&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svtools/source/filter/filter.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svtools/source/filter/filter.cxx Mon Dec 19 12:03:43 2011
@@ -1997,7 +1997,7 @@ sal_uInt16 GraphicFilter::ExportGraphic(
 			}
 			else if( aFilterName.EqualsIgnoreCaseAscii( EXP_SVG ) )
 			{
-                sal_Bool bDone = sal_False;
+                bool bDone(false);
                
                 // do we have a native SVG RenderGraphic, whose data can be written directly?
                 const SvgDataPtr aSvgDataPtr(rGraphic.getSvgData());

Modified: incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/descriptor.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/descriptor.cxx?rev=1220703&r1=1220702&r2=1220703&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/descriptor.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/descriptor.cxx Mon Dec 19 12:03:43 2011
@@ -393,7 +393,10 @@ void GraphicDescriptor::_getPropertyValu
 							case( GFX_LINK_TYPE_NATIVE_PNG ): pMimeType = MIMETYPE_PNG; break;
 							case( GFX_LINK_TYPE_NATIVE_WMF ): pMimeType = MIMETYPE_WMF; break;
 							case( GFX_LINK_TYPE_NATIVE_MET ): pMimeType = MIMETYPE_MET; break;
-							case( GFX_LINK_TYPE_NATIVE_PCT ): pMimeType = MIMETYPE_PCT ; break;
+							case( GFX_LINK_TYPE_NATIVE_PCT ): pMimeType = MIMETYPE_PCT; break;
+
+                            // added Svg mimetype support
+                            case( GFX_LINK_TYPE_NATIVE_SVG ): pMimeType = MIMETYPE_SVG; break;
 							
 							default:
 								pMimeType = NULL;

Modified: incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/provider.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/provider.cxx?rev=1220703&r1=1220702&r2=1220703&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/provider.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svtools/source/graphic/provider.cxx Mon Dec 19 12:03:43 2011
@@ -628,17 +628,24 @@ void ImplApplyFilterData( ::Graphic& rGr
 	}
 	if ( rGraphic.GetType() == GRAPHIC_BITMAP )
 	{
-		Rectangle aCropPixel( Point( 0, 0 ), rGraphic.GetSizePixel() );
-		ImplCalculateCropRect( rGraphic, aCropLogic, aCropPixel );
-		if ( bRemoveCropArea )
-		{
-			BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
-			aBmpEx.Crop( aCropPixel );
-			rGraphic = aBmpEx;
-		}
-		Size aVisiblePixelSize( bRemoveCropArea ? rGraphic.GetSizePixel() : aCropPixel.GetSize() );
-		ImplApplyBitmapResolution( rGraphic, nImageResolution, aVisiblePixelSize, aLogicalSize );
-		ImplApplyBitmapScaling( rGraphic, nPixelWidth, nPixelHeight );
+        if(rGraphic.getSvgData().get())
+        {
+            // embedded Svg, no need to scale. Also no method to apply crop data currently
+        }
+        else
+        {
+		    Rectangle aCropPixel( Point( 0, 0 ), rGraphic.GetSizePixel() );
+		    ImplCalculateCropRect( rGraphic, aCropLogic, aCropPixel );
+		    if ( bRemoveCropArea )
+		    {
+			    BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+			    aBmpEx.Crop( aCropPixel );
+			    rGraphic = aBmpEx;
+		    }
+		    Size aVisiblePixelSize( bRemoveCropArea ? rGraphic.GetSizePixel() : aCropPixel.GetSize() );
+		    ImplApplyBitmapResolution( rGraphic, nImageResolution, aVisiblePixelSize, aLogicalSize );
+		    ImplApplyBitmapScaling( rGraphic, nPixelWidth, nPixelHeight );
+        }
 	}
 	else if ( ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) && nImageResolution )
 	{