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 17:41:25 UTC

svn commit: r1220836 [3/4] - in /incubator/ooo/trunk: ./ main/ main/basegfx/inc/basegfx/color/ main/basegfx/inc/basegfx/matrix/ main/basegfx/inc/basegfx/polygon/ main/basegfx/source/color/ main/basegfx/source/polygon/ main/cppcanvas/source/mtfrenderer/...

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx Mon Dec 19 16:41:21 2011
@@ -321,6 +321,7 @@ SdrGrafObj::SdrGrafObj()
 	bMirrored		( sal_False )
 {
 	pGraphic = new GraphicObject;
+    mpReplacementGraphic = 0;
 	pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
 	
     // #i118485# Shear allowed and possible now
@@ -346,6 +347,7 @@ SdrGrafObj::SdrGrafObj(const Graphic& rG
 	bMirrored		( sal_False )
 {
 	pGraphic = new GraphicObject( rGrf );
+    mpReplacementGraphic = 0;
 	pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
 
     // #i118485# Shear allowed and possible now
@@ -371,6 +373,7 @@ SdrGrafObj::SdrGrafObj( const Graphic& r
 	bMirrored		( sal_False )
 {
 	pGraphic = new GraphicObject( rGrf );
+    mpReplacementGraphic = 0;
 	pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
 
     // #i118485# Shear allowed and possible now
@@ -393,6 +396,7 @@ SdrGrafObj::SdrGrafObj( const Graphic& r
 SdrGrafObj::~SdrGrafObj()
 {
 	delete pGraphic;
+    delete mpReplacementGraphic;
 	ImpLinkAbmeldung();
 }
 
@@ -401,6 +405,8 @@ SdrGrafObj::~SdrGrafObj()
 void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj )
 {
 	*pGraphic = rGrfObj;
+    delete mpReplacementGraphic;
+    mpReplacementGraphic = 0;
 	pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
 	pGraphic->SetUserData();
 	mbIsPreview = sal_False;
@@ -420,11 +426,28 @@ const GraphicObject& SdrGrafObj::GetGrap
 	return *pGraphic;
 }
 
+const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const
+{
+    if(!mpReplacementGraphic && pGraphic)
+    {
+        const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+
+        if(rSvgDataPtr.get())
+        {
+            const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
+        }
+    }
+
+    return mpReplacementGraphic;
+}
+
 // -----------------------------------------------------------------------------
 
 void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf )
 {
 	pGraphic->SetGraphic( rGrf );
+    delete mpReplacementGraphic;
+    mpReplacementGraphic = 0;
 	pGraphic->SetUserData();
 	mbIsPreview = sal_False;
 }
@@ -503,16 +526,6 @@ sal_Bool SdrGrafObj::IsEPS() const
 	return pGraphic->IsEPS();
 }
 
-sal_Bool SdrGrafObj::IsRenderGraphic() const
-{
-	return pGraphic->IsRenderGraphic();
-}
-
-sal_Bool SdrGrafObj::HasRenderGraphic() const
-{
-	return pGraphic->HasRenderGraphic();
-}
-
 sal_Bool SdrGrafObj::IsSwappedOut() const
 {
 	return mbIsPreview ? sal_True : pGraphic->IsSwappedOut();
@@ -667,7 +680,6 @@ void SdrGrafObj::ReleaseGraphicLink()
 void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
 {
 	FASTBOOL bAnim = pGraphic->IsAnimated();
-    FASTBOOL bRenderGraphic = pGraphic->HasRenderGraphic();
 	FASTBOOL bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj;
 
 	rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 ||
@@ -675,11 +687,11 @@ void SdrGrafObj::TakeObjInfo(SdrObjTrans
 							   aGeo.nDrehWink % 27000 == 0;
 
 	rInfo.bResizePropAllowed = sal_True;
-	rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic;
-	rInfo.bRotate90Allowed = bNoPresGrf && !bAnim && !bRenderGraphic;
-	rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic;
-	rInfo.bMirror45Allowed = bNoPresGrf && !bAnim && !bRenderGraphic;
-	rInfo.bMirror90Allowed = !bEmptyPresObj && !bRenderGraphic;
+	rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim;
+	rInfo.bRotate90Allowed = bNoPresGrf && !bAnim;
+	rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim;
+	rInfo.bMirror45Allowed = bNoPresGrf && !bAnim;
+	rInfo.bMirror90Allowed = !bEmptyPresObj;
 	rInfo.bTransparenceAllowed = sal_False;
 	rInfo.bGradientAllowed = sal_False;
 
@@ -687,10 +699,10 @@ void SdrGrafObj::TakeObjInfo(SdrObjTrans
 	rInfo.bShearAllowed = true;
 
     rInfo.bEdgeRadiusAllowed=sal_False;
-	rInfo.bCanConvToPath = !IsEPS() && !bRenderGraphic;
+	rInfo.bCanConvToPath = !IsEPS();
 	rInfo.bCanConvToPathLineToArea = sal_False;
 	rInfo.bCanConvToPolyLineToArea = sal_False;
-	rInfo.bCanConvToPoly = !IsEPS() && !bRenderGraphic;
+	rInfo.bCanConvToPoly = !IsEPS();
 	rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
 }
 
@@ -735,78 +747,102 @@ void SdrGrafObj::ImpSetLinkedGraphic( co
 
 void SdrGrafObj::TakeObjNameSingul(XubString& rName) const
 {
-	switch( pGraphic->GetType() )
-	{
-		case GRAPHIC_BITMAP:
-        {
-            const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
-                                 ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) :
-                                 ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) );
+    if(pGraphic)
+    {
+        const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
 
-            rName=ImpGetResStr( nId );
+        if(rSvgDataPtr.get())
+        {
+            rName = ImpGetResStr(STR_ObjNameSingulGRAFSVG);
         }
-        break;
+        else
+        {
+	        switch( pGraphic->GetType() )
+	        {
+		        case GRAPHIC_BITMAP:
+                {
+                    const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+                                         ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) :
+                                         ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) );
 
-		case GRAPHIC_GDIMETAFILE:
-            rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFMTFLNK : STR_ObjNameSingulGRAFMTF );
-        break;
+                    rName=ImpGetResStr( nId );
+                }
+                break;
 
-        case GRAPHIC_NONE:
-            rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFNONELNK : STR_ObjNameSingulGRAFNONE );
-        break;
-
-        default:
-            rName=ImpGetResStr(  IsLinkedGraphic() ? STR_ObjNameSingulGRAFLNK : STR_ObjNameSingulGRAF );
-        break;
-	}
+		        case GRAPHIC_GDIMETAFILE:
+                    rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFMTFLNK : STR_ObjNameSingulGRAFMTF );
+                break;
+
+                case GRAPHIC_NONE:
+                    rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFNONELNK : STR_ObjNameSingulGRAFNONE );
+                break;
+
+                default:
+                    rName=ImpGetResStr(  IsLinkedGraphic() ? STR_ObjNameSingulGRAFLNK : STR_ObjNameSingulGRAF );
+                break;
+	        }
+        }
 
-	const String aName(GetName());
+	    const String aName(GetName());
 
-	if( aName.Len() )
-	{
-		rName.AppendAscii( " '" );
-		rName += aName;
-		rName += sal_Unicode( '\'' );
-	}
+	    if( aName.Len() )
+	    {
+		    rName.AppendAscii( " '" );
+		    rName += aName;
+		    rName += sal_Unicode( '\'' );
+	    }
+    }
 }
 
 // -----------------------------------------------------------------------------
 
 void SdrGrafObj::TakeObjNamePlural( XubString& rName ) const
 {
-	switch( pGraphic->GetType() )
-	{
-		case GRAPHIC_BITMAP:
-        {
-            const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
-                                 ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) :
-                                 ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) );
+    if(pGraphic)
+    {
+        const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
 
-            rName=ImpGetResStr( nId );
+        if(rSvgDataPtr.get())
+        {
+            rName = ImpGetResStr(STR_ObjNamePluralGRAFSVG);
         }
-        break;
+        else
+        {
+	        switch( pGraphic->GetType() )
+	        {
+		        case GRAPHIC_BITMAP:
+                {
+                    const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+                                         ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) :
+                                         ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) );
 
-		case GRAPHIC_GDIMETAFILE:
-            rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFMTFLNK : STR_ObjNamePluralGRAFMTF );
-        break;
+                    rName=ImpGetResStr( nId );
+                }
+                break;
 
-        case GRAPHIC_NONE:
-            rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFNONELNK : STR_ObjNamePluralGRAFNONE );
-        break;
-
-        default:
-            rName=ImpGetResStr(  IsLinkedGraphic() ? STR_ObjNamePluralGRAFLNK : STR_ObjNamePluralGRAF );
-        break;
-	}
+		        case GRAPHIC_GDIMETAFILE:
+                    rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFMTFLNK : STR_ObjNamePluralGRAFMTF );
+                break;
+
+                case GRAPHIC_NONE:
+                    rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFNONELNK : STR_ObjNamePluralGRAFNONE );
+                break;
+
+                default:
+                    rName=ImpGetResStr(  IsLinkedGraphic() ? STR_ObjNamePluralGRAFLNK : STR_ObjNamePluralGRAF );
+                break;
+	        }
+        }
 
-	const String aName(GetName());
+	    const String aName(GetName());
 
-	if( aName.Len() )
-	{
-		rName.AppendAscii( " '" );
-		rName += aName;
-		rName += sal_Unicode( '\'' );
-	}
+	    if( aName.Len() )
+	    {
+		    rName.AppendAscii( " '" );
+		    rName += aName;
+		    rName += sal_Unicode( '\'' );
+	    }
+    }
 }
 
 // -----------------------------------------------------------------------------
@@ -1055,11 +1091,57 @@ const GDIMetaFile* SdrGrafObj::GetGDIMet
 
 // -----------------------------------------------------------------------------
 
+bool SdrGrafObj::isEmbeddedSvg() const
+{
+    return GRAPHIC_BITMAP == GetGraphicType() && GetGraphic().getSvgData().get();
+}
+
+GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const
+{
+    GDIMetaFile aRetval;
+
+    if(isEmbeddedSvg() && GetModel())
+    {
+        VirtualDevice aOut;
+        const Rectangle aBoundRect(GetCurrentBoundRect());
+        const MapMode aMap(GetModel()->GetScaleUnit(), Point(), GetModel()->GetScaleFraction(), GetModel()->GetScaleFraction());
+
+        aOut.EnableOutput(false);
+        aOut.SetMapMode(aMap);
+        aRetval.Record(&aOut);
+        SingleObjectPainter(aOut);
+        aRetval.Stop();
+        aRetval.WindStart();
+        aRetval.Move(-aBoundRect.Left(), -aBoundRect.Top());
+        aRetval.SetPrefMapMode(aMap);
+        aRetval.SetPrefSize(aBoundRect.GetSize());
+    }
+
+    return aRetval;
+}
+
 SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const
 {
 	SdrObject* pRetval = NULL;
+    GraphicType aGraphicType(GetGraphicType());
+    GDIMetaFile aMtf;
 
-	switch( GetGraphicType() )
+    if(isEmbeddedSvg())
+    {
+        // Embedded Svg
+        // There is currently no helper to create SdrObjects from primitives (even if I'm thinking
+        // about writing one for some time). To get the roundtrip to SdrObjects it is necessary to
+        // use the old converter path over the MetaFile mechanism. Create Metafile from Svg 
+        // primitives here pretty directly
+        aMtf = getMetafileFromEmbeddedSvg();
+        aGraphicType = GRAPHIC_GDIMETAFILE;
+    }
+    else if(GRAPHIC_GDIMETAFILE == aGraphicType)
+    {
+        aMtf = GetTransformedGraphic(SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile();
+    }
+
+	switch(aGraphicType)
 	{
 		case GRAPHIC_GDIMETAFILE:
 		{
@@ -1069,14 +1151,12 @@ SdrObject* SdrGrafObj::DoConvertToPolyOb
 			aFilter.SetLayer(GetLayer());
 
 			SdrObjGroup* pGrp = new SdrObjGroup();
-			sal_uInt32 nInsAnz = aFilter.DoImport(GetTransformedGraphic(
-                SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile(), 
-                *pGrp->GetSubList(), 0);
+			sal_uInt32 nInsAnz = aFilter.DoImport(aMtf, *pGrp->GetSubList(), 0);
 
             if(nInsAnz)
 			{
                 {
-                    // copy transformation
+                        // copy transformation
                 	GeoStat aGeoStat(GetGeoStat());
 
 	                if(aGeoStat.nShearWink) 
@@ -1343,9 +1423,6 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, Graph
                     
 					if(mbInsidePaint && !GetViewContact().HasViewObjectContacts(true))
                     {
-//							Rectangle aSnapRect(GetSnapRect());
-//							const Rectangle aSnapRectPixel(pOutDev->LogicToPixel(aSnapRect));
-
                         pFilterData = new com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >( 3 );
 
                         com::sun::star::awt::Size aPreviewSizeHint( 64, 64 );
@@ -1361,8 +1438,9 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, Graph
                         mbIsPreview = sal_True;
                     }
 
-                    if( !GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), *pStream,
-                                                        GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData ) )
+                    if(!GraphicFilter::GetGraphicFilter()->ImportGraphic(
+                        aGraphic, aStreamInfo.maUserData, *pStream,
+                        GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData))
                     {
                         const String aUserData( pGraphic->GetUserData() );
 

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdorect.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdorect.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdorect.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdorect.cxx Mon Dec 19 16:41:21 2011
@@ -591,7 +591,10 @@ SdrObject* SdrRectObj::DoConvertToPolyOb
     aPolyPolygon.removeDoublePoints();
 	SdrObject* pRet = 0L;
 	
-	if(!IsTextFrame() || HasFill() || HasLine()) 
+    // small correction: Do not create something when no fill and no line. To
+    // be sure to not damage something with non-text frames, do this only
+    // when used with bAddText==false from other converters
+	if((bAddText && !IsTextFrame()) || HasFill() || HasLine()) 
 	{
 		pRet = ImpConvertMakeObj(aPolyPolygon, sal_True, bBezier);
 	}

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdstr.src
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdstr.src?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdstr.src (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdstr.src Mon Dec 19 16:41:21 2011
@@ -474,7 +474,21 @@ String STR_ObjNamePluralGRAFMACLNK
 {
 	Text [ en-US ] = "Linked Mac graphics" ;
 };
- ////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Svg support
+
+String STR_ObjNameSingulGRAFSVG
+{
+	Text [ en-US ] = "SVG" ;
+};
+String STR_ObjNamePluralGRAFSVG
+{
+	Text [ en-US ] = "SVGs" ;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
 String STR_ObjNameSingulOLE2
 {
 	Text [ en-US ] = "embedded object (OLE)" ;

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx Mon Dec 19 16:41:21 2011
@@ -529,20 +529,34 @@ void SdrExchangeView::ImpPasteObject(Sdr
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-Bitmap SdrExchangeView::GetMarkedObjBitmap( sal_Bool bNoVDevIfOneBmpMarked ) const
+BitmapEx SdrExchangeView::GetMarkedObjBitmap( bool bNoVDevIfOneBmpMarked ) const
 {
-	Bitmap aBmp;
+	BitmapEx aBmp;
 
 	if( AreObjectsMarked() )
 	{
-		if( bNoVDevIfOneBmpMarked )
-		{
-			SdrObject*	pGrafObjTmp	= GetMarkedObjectByIndex( 0 );
-			SdrGrafObj*	pGrafObj = ( GetMarkedObjectCount() == 1 ) ? PTR_CAST( SdrGrafObj, pGrafObjTmp ) : NULL;
+        if(1 == GetMarkedObjectCount())
+        {
+            if(bNoVDevIfOneBmpMarked)
+            {
+                SdrObject*	pGrafObjTmp	= GetMarkedObjectByIndex( 0 );
+                SdrGrafObj*	pGrafObj = ( GetMarkedObjectCount() == 1 ) ? PTR_CAST( SdrGrafObj, pGrafObjTmp ) : NULL;
 
-			if( pGrafObj && ( pGrafObj->GetGraphicType() == GRAPHIC_BITMAP ) )
-				aBmp = pGrafObj->GetTransformedGraphic().GetBitmap();
-		}
+                if( pGrafObj && ( pGrafObj->GetGraphicType() == GRAPHIC_BITMAP ) )
+                {
+                    aBmp = pGrafObj->GetTransformedGraphic().GetBitmapEx();
+                }
+            }
+            else
+            {
+                const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(GetMarkedObjectByIndex(0));
+
+                if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
+                {
+                    aBmp = pSdrGrafObj->GetGraphic().getSvgData()->getReplacement();
+                }
+            }
+        }
 
 		if( !aBmp )
 		{
@@ -557,7 +571,7 @@ Bitmap SdrExchangeView::GetMarkedObjBitm
                 aDrawinglayerOpt.IsAntiAliasing(),
                 aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete());
 
-            aBmp = aGraphic.GetBitmap(aParameters);
+            aBmp = aGraphic.GetBitmapEx(aParameters);
 		}
 	}
 
@@ -665,10 +679,18 @@ Graphic SdrExchangeView::GetObjGraphic( 
         
 		if(pSdrGrafObj)
         {
-            // #110981# Make behaviour coherent with metafile
-            // recording below (which of course also takes
-            // view-transformed objects)
-            aRet = pSdrGrafObj->GetTransformedGraphic();
+            if(pSdrGrafObj->isEmbeddedSvg())
+            {
+                // get Metafile for Svg content
+                aRet = pSdrGrafObj->getMetafileFromEmbeddedSvg();
+            }
+            else
+            {
+                // #110981# Make behaviour coherent with metafile
+                // recording below (which of course also takes
+                // view-transformed objects)
+                aRet = pSdrGrafObj->GetTransformedGraphic();
+            }
         }
         else if(pSdrOle2Obj)
         {

Modified: incubator/ooo/trunk/main/svx/source/tbxctrls/grafctrl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/tbxctrls/grafctrl.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/tbxctrls/grafctrl.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/tbxctrls/grafctrl.cxx Mon Dec 19 16:41:21 2011
@@ -1145,8 +1145,7 @@ void SvxGrafAttrHelper::GetGrafAttrState
 
         if( !pGrafObj ||
             ( pGrafObj->GetGraphicType() == GRAPHIC_NONE ) ||
-            ( pGrafObj->GetGraphicType() == GRAPHIC_DEFAULT  ) ||
-            pGrafObj->HasRenderGraphic() )
+            ( pGrafObj->GetGraphicType() == GRAPHIC_DEFAULT  ))
         {
             bEnableColors = bEnableTransparency = bEnableCrop = false;
             break;

Modified: incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx Mon Dec 19 16:41:21 2011
@@ -1843,7 +1843,21 @@ bool SvxGraphicObject::getPropertyValueI
 		break;
 	}
 
-	case OWN_ATTR_GRAFSTREAMURL:
+	case OWN_ATTR_REPLACEMENTGRAFURL:
+	{
+		const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
+
+        if(pGrafObj)
+        {
+			OUString aURL(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
+			aURL += OUString::createFromAscii(pGrafObj->GetUniqueID().GetBuffer());
+			rValue <<= aURL;
+        }
+
+		break;
+	}
+
+    case OWN_ATTR_GRAFSTREAMURL:
 	{
 		const OUString	aStreamURL( ( (SdrGrafObj*) mpObj.get() )->GetGrafStreamURL() );
 		if( aStreamURL.getLength() )

Modified: incubator/ooo/trunk/main/svx/source/xml/xmlgrhlp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/xml/xmlgrhlp.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/xml/xmlgrhlp.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/xml/xmlgrhlp.cxx Mon Dec 19 16:41:21 2011
@@ -149,7 +149,7 @@ SvXMLGraphicInputStream::SvXMLGraphicInp
 				{
 					pStm->SetVersion( SOFFICE_FILEFORMAT_8 );
 					pStm->SetCompressMode( COMPRESSMODE_ZBITMAP );
-					( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC );
+					( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm );
     			    bRet = ( pStm->GetError() == 0 );
 				}
 			}
@@ -645,7 +645,7 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGr
 						pStream->Write( rLink.GetData(), rLink.GetDataSize() );
 					}
 					else
-						rMtf.Write( *pStream, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC );
+						rMtf.Write( *pStream );
 
 					bRet = ( pStream->GetError() == 0 );
 				}

Modified: incubator/ooo/trunk/main/sw/inc/cmdid.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/cmdid.h?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/inc/cmdid.h (original)
+++ incubator/ooo/trunk/main/sw/inc/cmdid.h Mon Dec 19 16:41:21 2011
@@ -910,6 +910,8 @@ Achtung: Ab sofort sind in diesem File k
 
 #define FN_EMBEDDED_OBJECT                  (FN_EXTRA2 + 116)
 
+#define FN_UNO_REPLACEMENT_GRAPHIC_U_R_L    (FN_EXTRA2 + 117)
+
 /*--------------------------------------------------------------------
 	Bereich: Hilfe
  --------------------------------------------------------------------*/

Modified: incubator/ooo/trunk/main/sw/inc/ndgrf.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/ndgrf.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/inc/ndgrf.hxx (original)
+++ incubator/ooo/trunk/main/sw/inc/ndgrf.hxx Mon Dec 19 16:41:21 2011
@@ -46,6 +46,7 @@ class SW_DLLPUBLIC SwGrfNode: public SwN
 	friend class SwNodes;
 
 	GraphicObject aGrfObj;
+	GraphicObject* mpReplacementGraphic;
     ::sfx2::SvBaseLinkRef refLink;       // falls Grafik nur als Link, dann Pointer gesetzt
 	Size nGrfSize;
 //	String aStrmName;			// SW3: Name des Storage-Streams fuer Embedded
@@ -146,6 +147,7 @@ public:
 	const Graphic& 			GetGrf() const  	{ return aGrfObj.GetGraphic(); }
 	const GraphicObject&	GetGrfObj() const  	{ return aGrfObj; }
 		  GraphicObject&	GetGrfObj() 		{ return aGrfObj; }
+    const GraphicObject* GetReplacementGrfObj() const;
 
     virtual SwCntntNode *SplitCntntNode( const SwPosition & );
 

Modified: incubator/ooo/trunk/main/sw/inc/unoprnms.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/unoprnms.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/inc/unoprnms.hxx (original)
+++ incubator/ooo/trunk/main/sw/inc/unoprnms.hxx Mon Dec 19 16:41:21 2011
@@ -803,7 +803,10 @@ enum SwPropNameIds
 /* 0738 */  UNO_NAME_META,       // #i91565#
 /* 0739 */  UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
 /* 0740 */  UNO_NAME_EMBEDDED_OBJECT,
-/* 0741 */  SW_PROPNAME_END
+
+/* 0741 */	UNO_NAME_REPLACEMENT_GRAPHIC_URL,
+
+/* 0742 */  SW_PROPNAME_END
 };
 
 

Modified: incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx Mon Dec 19 16:41:21 2011
@@ -78,6 +78,11 @@
 #include <dview.hxx>
 // <--
 
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
 using namespace com::sun::star;
 
 #define DEFTEXTSIZE  12
@@ -940,10 +945,102 @@ void SwNoTxtFrm::PaintPicture( OutputDev
                                         aAlignedGrfArea.SSize(), long(this),
 										0, GRFMGR_DRAW_STANDARD, pVout );
 				}
-				else
-                    rGrfObj.DrawWithPDFHandling( *pOut,
-                                                 aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(),
-                                                 &aGrfAttr );
+                else
+                {
+                    const SvgDataPtr& rSvgDataPtr = rGrfObj.GetGraphic().getSvgData();
+                    bool bDone(false);
+
+                    if(rSvgDataPtr.get())
+                    {
+                        // Graphic is Svg and can be painted as primitives (vector graphic)
+                        const basegfx::B2DRange& rRange = rSvgDataPtr->getRange();
+                        const double fWidth(rRange.getWidth());
+                        const double fHeight(rRange.getHeight());
+                        const drawinglayer::primitive2d::Primitive2DSequence& rSequence = rSvgDataPtr->getPrimitive2DSequence();
+
+                        if(rSequence.hasElements() && !basegfx::fTools::equalZero(fWidth) && !basegfx::fTools::equalZero(fHeight))
+                        {
+                            // get target range
+                            const basegfx::B2DRange aTargetRange(
+                                aAlignedGrfArea.Left(), aAlignedGrfArea.Top(), 
+                                aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
+
+                            // prepare evtl. cropped range
+                            basegfx::B2DRange aCroppedTargetRange(aTargetRange);
+
+                            if(aGrfAttr.IsCropped())
+                            {
+                                // calculate original TargetRange
+                                const double fFactor100thmmToTwips(72.0 / 127.0);
+
+                                aCroppedTargetRange = basegfx::B2DRange(
+                                    aTargetRange.getMinX() - (aGrfAttr.GetLeftCrop() * fFactor100thmmToTwips),
+                                    aTargetRange.getMinY() - (aGrfAttr.GetTopCrop() * fFactor100thmmToTwips),
+                                    aTargetRange.getMaxX() + (aGrfAttr.GetRightCrop() * fFactor100thmmToTwips),
+                                    aTargetRange.getMaxY() + (aGrfAttr.GetBottomCrop() * fFactor100thmmToTwips));
+                            }
+
+                            const double fTargetWidth(aCroppedTargetRange.getWidth());
+                            const double fTargetHeight(aCroppedTargetRange.getHeight());
+                            
+                            if(!basegfx::fTools::equalZero(fTargetWidth) && !basegfx::fTools::equalZero(fTargetHeight))
+                            {
+                                // map graphic range to target range. This will automatically include
+                                // tme mapping from Svg 1/100th mm content to twips since the target
+                                // range is twips already
+                                basegfx::B2DHomMatrix aMappingTransform(
+                                    basegfx::tools::createTranslateB2DHomMatrix(
+                                        -rRange.getMinX(), 
+                                        -rRange.getMinY()));
+
+                                aMappingTransform.scale(fTargetWidth / fWidth, fTargetHeight / fHeight);
+                                aMappingTransform.translate(aCroppedTargetRange.getMinX(), aCroppedTargetRange.getMinY());
+
+                                // check for and apply mirrorings
+                                const bool bMirrorHor(aGrfAttr.GetMirrorFlags() & BMP_MIRROR_HORZ);
+                                const bool bMirrorVer(aGrfAttr.GetMirrorFlags() & BMP_MIRROR_VERT);
+
+                                if(bMirrorHor || bMirrorVer)
+                                {
+                                    aMappingTransform.translate(-aCroppedTargetRange.getCenterX(), -aCroppedTargetRange.getCenterY());
+                                    aMappingTransform.scale(bMirrorHor ? -1.0 : 1.0, bMirrorVer ? -1.0 : 1.0);
+                                    aMappingTransform.translate(aCroppedTargetRange.getCenterX(), aCroppedTargetRange.getCenterY());
+                                }
+
+                                // Fill ViewInformation. Use MappingTransform here, so there is no need to
+                                // embed the primitives to it. Use original TargetRange here so there is also
+                                // no need to embed the primitives to a MaskPrimitive for cropping. This works 
+                                // only in this case where the graphic object cannot be rotated, though.
+                                const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
+                                    aMappingTransform, 
+                                    pOut->GetViewTransformation(), 
+                                    aTargetRange, 
+                                    0,
+                                    0.0, 
+                                    com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >());
+
+                                // get a primitive processor for rendering
+                                drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = sdr::contact::createBaseProcessor2DFromOutputDevice(
+                                    *pOut, 
+                                    aViewInformation2D);
+
+                                if(pProcessor2D)
+                                {
+                                    // render and cleanup
+                                    pProcessor2D->process(rSequence);
+                                    delete pProcessor2D;
+                                    bDone = true;
+                                }
+                            }
+                        }
+                    }
+
+                    if(!bDone)
+                    {
+                        // fallback paint, uses replacement image
+                        rGrfObj.DrawWithPDFHandling(*pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr);
+                    }
+                }
 			}
 			else
 			{

Modified: incubator/ooo/trunk/main/sw/source/core/graphic/ndgrf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/graphic/ndgrf.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/graphic/ndgrf.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/graphic/ndgrf.cxx Mon Dec 19 16:41:21 2011
@@ -73,6 +73,8 @@ SwGrfNode::SwGrfNode(
         SwGrfFmtColl *pGrfColl,
         SwAttrSet* pAutoAttr ) :
     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
+    aGrfObj(),
+    mpReplacementGraphic(0),
     // --> OD 2007-01-23 #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( sal_False )
@@ -90,6 +92,8 @@ SwGrfNode::SwGrfNode( const SwNodeIndex 
 				  		const GraphicObject& rGrfObj,
                       SwGrfFmtColl *pGrfColl, SwAttrSet* pAutoAttr ) :
     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
+	aGrfObj(rGrfObj),
+    mpReplacementGraphic(0),
     // --> OD 2007-01-23 #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( sal_False )
@@ -113,6 +117,8 @@ SwGrfNode::SwGrfNode( const SwNodeIndex 
                       SwGrfFmtColl *pGrfColl,
                       SwAttrSet* pAutoAttr ) :
     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
+    aGrfObj(),
+    mpReplacementGraphic(0),
     // --> OD 2007-01-23 #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( sal_False )
@@ -146,6 +152,8 @@ sal_Bool SwGrfNode::ReRead(
     sal_Bool bNewGrf )
 {
 	sal_Bool bReadGrf = sal_False, bSetTwipSize = sal_True;
+    delete mpReplacementGraphic;
+    mpReplacementGraphic = 0;
 
 	ASSERT( pGraphic || pGrfObj || rGrfName.Len(),
 			"GraphicNode without a name, Graphic or GraphicObject" );
@@ -315,6 +323,9 @@ sal_Bool SwGrfNode::ReRead(
 
 SwGrfNode::~SwGrfNode()
 {
+    delete mpReplacementGraphic;
+    mpReplacementGraphic = 0;
+
     // --> OD 2007-03-30 #i73788#
     mpThreadConsumer.reset();
     // <--
@@ -348,6 +359,21 @@ SwGrfNode::~SwGrfNode()
 }
 
 
+const GraphicObject* SwGrfNode::GetReplacementGrfObj() const
+{
+    if(!mpReplacementGraphic)
+    {
+        const SvgDataPtr& rSvgDataPtr = GetGrfObj().GetGraphic().getSvgData();
+
+        if(rSvgDataPtr.get())
+        {
+            const_cast< SwGrfNode* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
+        }
+    }
+
+    return mpReplacementGraphic;
+}
+
 SwCntntNode *SwGrfNode::SplitCntntNode( const SwPosition & )
 {
 	return this;
@@ -394,12 +420,15 @@ Size SwGrfNode::GetTwipSize() const
 sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm )
 {
 	Graphic aGraphic;
-	if( !GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), rStrm ) )
-	{
-		const String aUserData( aGrfObj.GetUserData() );
-
-		aGrfObj.SetGraphic( aGraphic );
-		aGrfObj.SetUserData( aUserData );
+    const String aURL(aGrfObj.GetUserData());
+	
+    if(!GraphicFilter::GetGraphicFilter()->ImportGraphic(aGraphic, aURL, rStrm))
+	{
+        delete mpReplacementGraphic;
+        mpReplacementGraphic = 0;
+		
+        aGrfObj.SetGraphic( aGraphic );
+		aGrfObj.SetUserData( aURL );
 		return sal_True;
 	}
 
@@ -432,6 +461,9 @@ short SwGrfNode::SwapIn( sal_Bool bWaitF
 			else if( GRAPHIC_DEFAULT == aGrfObj.GetType() )
 			{
 				// keine default Bitmap mehr, also neu Painten!
+                delete mpReplacementGraphic;
+                mpReplacementGraphic = 0;
+
 				aGrfObj.SetGraphic( Graphic() );
 				SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
 				ModifyNotification( &aMsgHint, &aMsgHint );
@@ -904,7 +936,8 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc*
             SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
             if ( pStrm )
             {
-                GraphicFilter::GetGraphicFilter()->ImportGraphic( aTmpGrf, String(), *pStrm );
+                const String aURL(aGrfObj.GetUserData());
+                GraphicFilter::GetGraphicFilter()->ImportGraphic(aTmpGrf, aURL, *pStrm);
                 delete pStrm;
             }
             // <--

Modified: incubator/ooo/trunk/main/sw/source/core/unocore/unoframe.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/unocore/unoframe.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/unocore/unoframe.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/unocore/unoframe.cxx Mon Dec 19 16:41:21 2011
@@ -1499,6 +1499,30 @@ uno::Any SwXFrame::getPropertyValue(cons
 			}
 			aAny <<= OUString(sGrfName);
 		}
+        else if( FN_UNO_REPLACEMENT_GRAPHIC_U_R_L == pEntry->nWID)
+        {
+            String sGrfName;
+            const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+            
+            if(pIdx)
+            {
+                SwNodeIndex aIdx(*pIdx, 1);
+                SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+                if(!pGrfNode)
+                    throw uno::RuntimeException();
+
+                const GraphicObject* pGraphicObject = pGrfNode->GetReplacementGrfObj();
+
+                if(pGraphicObject)
+                {
+                    String sPrefix( RTL_CONSTASCII_STRINGPARAM(sGraphicObjectProtocol) );
+                    String sId( pGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
+                    (sGrfName = sPrefix) += sId;
+                }
+            }
+
+            aAny <<= OUString(sGrfName);
+        }
         else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
 		{
 			String sFltName;

Modified: incubator/ooo/trunk/main/sw/source/core/unocore/unomap.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/unocore/unomap.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/unocore/unomap.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/unocore/unomap.cxx Mon Dec 19 16:41:21 2011
@@ -1108,6 +1108,7 @@ const SfxItemPropertyMapEntry* SwUnoProp
 					{ SW_PROP_NMID(UNO_NAME_HORI_MIRRORED_ON_ODD_PAGES), RES_GRFATR_MIRRORGRF,	CPPU_E2T(CPPUTYPE_BOOLEAN), 			PROPERTY_NONE,		MID_MIRROR_HORZ_ODD_PAGES				  },
 					{ SW_PROP_NMID(UNO_NAME_VERT_MIRRORED), RES_GRFATR_MIRRORGRF,   CPPU_E2T(CPPUTYPE_BOOLEAN), 			PROPERTY_NONE,     MID_MIRROR_VERT			  },
                     { SW_PROP_NMID(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_U_R_L, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
+                    { SW_PROP_NMID(UNO_NAME_REPLACEMENT_GRAPHIC_URL), FN_UNO_REPLACEMENT_GRAPHIC_U_R_L, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
                     { SW_PROP_NMID(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER,      CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
                     { SW_PROP_NMID(UNO_NAME_GRAPHIC), FN_UNO_GRAPHIC, CPPU_E2T(CPPUTYPE_REFXGRAPHIC), 0, 0 },
                     { SW_PROP_NMID(UNO_NAME_ACTUAL_SIZE), FN_UNO_ACTUAL_SIZE,    CPPU_E2T(CPPUTYPE_AWTSIZE),  PropertyAttribute::READONLY, CONVERT_TWIPS},

Modified: incubator/ooo/trunk/main/sw/source/core/unocore/unoprnms.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/unocore/unoprnms.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/unocore/unoprnms.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/unocore/unoprnms.cxx Mon Dec 19 16:41:21 2011
@@ -776,6 +776,7 @@ const SwPropNameTab aPropNameTab = {
 /* 0738 UNO_NAME_META */        {MAP_CHAR_LEN("InContentMetadata")},
 /* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
 /* 0740 UNO_NAME_EMBEDDED_OBJECT */ {MAP_CHAR_LEN("EmbeddedObject")},
+/* 0741 UNO_NAME_REPLACEMENT_GRAPHIC_URL */ {MAP_CHAR_LEN("ReplacementGraphicURL")},
 };
 
 const SwPropNameLen& SwGetPropName( sal_uInt16 nId )

Modified: incubator/ooo/trunk/main/sw/source/ui/shells/grfsh.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/ui/shells/grfsh.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/ui/shells/grfsh.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/ui/shells/grfsh.cxx Mon Dec 19 16:41:21 2011
@@ -515,13 +515,6 @@ void SwGrfShell::GetAttrState(SfxItemSet
     rSh.GetCurAttr( aCoreSet );
 	sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
 	sal_Bool bIsGrfCntnt = CNT_GRF == GetShell().GetCntType();
-//    const GraphicObject* pGrfObj = ( bIsGrfCntnt ? rSh.GetGraphicObj() : NULL );
-//    sal_Bool bIsRenderGraphicGrfCntnt = ( pGrfObj && pGrfObj->IsRenderGraphic() );
-
-    // --> OD 2006-11-03 #i59688#
-//    sal_Bool bSwappedOut = rSh.IsGrfSwapOut( sal_True );
-//    sal_Bool bBitmapType = !bSwappedOut && GRAPHIC_BITMAP == rSh.GetGraphicType();
-    // <--
 
     SetGetStateSet( &rSet );
 

Modified: incubator/ooo/trunk/main/vcl/Library_vcl.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/Library_vcl.mk?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/Library_vcl.mk (original)
+++ incubator/ooo/trunk/main/vcl/Library_vcl.mk Mon Dec 19 16:41:21 2011
@@ -379,14 +379,12 @@ $(eval $(call gb_Library_add_exception_o
     vcl/source/gdi/print \
     vcl/source/gdi/regband \
     vcl/source/gdi/region \
-    vcl/source/gdi/rendergraphic \
-    vcl/source/gdi/rendergraphicrasterizer \
     vcl/source/gdi/salgdilayout \
     vcl/source/gdi/sallayout \
     vcl/source/gdi/salmisc \
     vcl/source/gdi/salnativewidgets-none \
-    vcl/source/gdi/svgread \
-	vcl/source/gdi/textlayout \
+    vcl/source/gdi/svgdata \
+    vcl/source/gdi/textlayout \
     vcl/source/gdi/virdev \
     vcl/source/gdi/wall \
     vcl/source/helper/canvasbitmap \

Modified: incubator/ooo/trunk/main/vcl/Package_inc.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/Package_inc.mk?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/Package_inc.mk (original)
+++ incubator/ooo/trunk/main/vcl/Package_inc.mk Mon Dec 19 16:41:21 2011
@@ -119,8 +119,6 @@ $(eval $(call gb_Package_add_file,vcl_in
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/quickselectionengine.hxx,vcl/quickselectionengine.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/regband.hxx,vcl/regband.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/region.hxx,vcl/region.hxx))
-$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/rendergraphicrasterizer.hxx,vcl/rendergraphicrasterizer.hxx))
-$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/rendergraphic.hxx,vcl/rendergraphic.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/salbtype.hxx,vcl/salbtype.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/salctype.hxx,vcl/salctype.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/salgtype.hxx,vcl/salgtype.hxx))
@@ -141,7 +139,7 @@ $(eval $(call gb_Package_add_file,vcl_in
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/strhelper.hxx,vcl/strhelper.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/svapp.hxx,vcl/svapp.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/sv.h,vcl/sv.h))
-$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/svgread.hxx,vcl/svgread.hxx))
+$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/svgdata.hxx,vcl/svgdata.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/symbol.hxx,vcl/symbol.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/syschild.hxx,vcl/syschild.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/sysdata.hxx,vcl/sysdata.hxx))

Modified: incubator/ooo/trunk/main/vcl/inc/impgraph.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/impgraph.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/impgraph.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/impgraph.hxx Mon Dec 19 16:41:21 2011
@@ -33,8 +33,8 @@
 #include <vcl/bitmapex.hxx>
 #include <vcl/animate.hxx>
 #include <vcl/gdimtf.hxx>
-#include <vcl/rendergraphic.hxx>
 #include <vcl/graph.h>
+#include <vcl/svgdata.hxx>
 
 // ---------------
 // - ImpSwapInfo -
@@ -70,11 +70,14 @@ private:
 	GfxLink*			mpGfxLink;
 	GraphicType			meType;
 	String				maDocFileURLStr;
-	sal_uLong				mnDocFilePos;
-    mutable sal_uLong       mnSizeBytes;
-	sal_uLong				mnRefCount;
-	sal_Bool				mbSwapOut;
-	sal_Bool				mbSwapUnderway;
+	sal_uLong			mnDocFilePos;
+    mutable sal_uLong   mnSizeBytes;
+	sal_uLong			mnRefCount;
+	sal_Bool			mbSwapOut;
+	sal_Bool			mbSwapUnderway;
+
+    // SvgData support
+    SvgDataPtr          maSvgData;
 
 private:
 
@@ -82,11 +85,12 @@ private:
 						ImpGraphic( const ImpGraphic& rImpGraphic );
 						ImpGraphic( const Bitmap& rBmp );
 						ImpGraphic( const BitmapEx& rBmpEx );
+						ImpGraphic(const SvgDataPtr& rSvgDataPtr);
 						ImpGraphic( const Animation& rAnimation );
 						ImpGraphic( const GDIMetaFile& rMtf );
 	virtual				~ImpGraphic();
 
-	ImpGraphic&			operator=( const ImpGraphic& rImpGraphic );
+    ImpGraphic&			operator=( const ImpGraphic& rImpGraphic );
 	sal_Bool				operator==( const ImpGraphic& rImpGraphic ) const;
 	sal_Bool				operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); }
 
@@ -101,14 +105,11 @@ private:
 	sal_Bool			ImplIsAlpha() const;
 	sal_Bool			ImplIsAnimated() const;
 	sal_Bool			ImplIsEPS() const;
-	sal_Bool			ImplIsRenderGraphic() const;
-	sal_Bool			ImplHasRenderGraphic() const;
 
 	Bitmap				    ImplGetBitmap(const GraphicConversionParameters& rParameters) const;
 	BitmapEx			    ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const;
 	Animation			    ImplGetAnimation() const;
 	const GDIMetaFile&	    ImplGetGDIMetaFile() const;
-    ::vcl::RenderGraphic    ImplGetRenderGraphic() const;
 
 
 	Size				ImplGetPrefSize() const;
@@ -177,6 +178,9 @@ private:
 
 	friend SvStream&	operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic );
 	friend SvStream&	operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic );
+
+    // SvgData support
+    const SvgDataPtr& getSvgData() const;
 };
 
 #endif // _SV_IMPGRAPH_HXX

Modified: incubator/ooo/trunk/main/vcl/inc/sallayout.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/sallayout.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/sallayout.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/sallayout.hxx Mon Dec 19 16:41:21 2011
@@ -29,12 +29,8 @@
 #define _SV_SALLAYOUT_HXX
 
 #include <tools/gen.hxx>
-
 #include <vector>
-namespace basegfx {
-	class B2DPolyPolygon;
-	typedef std::vector<B2DPolyPolygon> B2DPolyPolygonVector;
-}
+#include <basegfx/polygon/b2dpolypolygon.hxx>
 
 #ifndef _TOOLS_LANG_HXX
 typedef unsigned short LanguageType;

Modified: incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx Mon Dec 19 16:41:21 2011
@@ -64,15 +64,6 @@ class Gradient;
 #define MTF_MIRROR_HORZ				0x00000001UL
 #define MTF_MIRROR_VERT				0x00000002UL
 
-// -----------------------------
-// - Write flags for streaming -
-// -----------------------------
-
-#define GDIMETAFILE_WRITE_DEFAULT                   0x00000000
-#define GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC 0x00000001
-
-typedef sal_uInt32 GDIMetaFileWriteFlags;
-
 // ---------
 // - Enums -
 // ---------
@@ -242,7 +233,7 @@ public:
 	// Methoden zum Lesen und Schreiben des neuen Formats;
 	// die Read-Methode kann auch das alte Format lesen
 	SvStream&		Read( SvStream& rIStm );
-	SvStream&		Write( SvStream& rOStm, GDIMetaFileWriteFlags = GDIMETAFILE_WRITE_DEFAULT );
+	SvStream&		Write( SvStream& rOStm );
 
 	// Stream-Operatoren schreiben das alte Format (noch)
 	// und lesen sowohl das alte wie auch das neue Format

Modified: incubator/ooo/trunk/main/vcl/inc/vcl/graph.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/vcl/graph.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/vcl/graph.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/vcl/graph.hxx Mon Dec 19 16:41:21 2011
@@ -31,10 +31,10 @@
 #include <vcl/bitmapex.hxx>
 #include <vcl/animate.hxx>
 #include <vcl/gdimtf.hxx>
-#include <vcl/rendergraphic.hxx>
 #include <vcl/graph.h>
 #include <vcl/gfxlink.hxx>
 #include <com/sun/star/uno/Reference.hxx>
+#include <vcl/svgdata.hxx>
 
 namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } }
 
@@ -100,6 +100,7 @@ public:
                         Graphic( const Graphic& rGraphic );
                         Graphic( const Bitmap& rBmp );
                         Graphic( const BitmapEx& rBmpEx );
+                        Graphic(const SvgDataPtr& rSvgDataPtr);
                         Graphic( const Animation& rAnimation );
                         Graphic( const GDIMetaFile& rMtf );
 						Graphic( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic );
@@ -120,8 +121,6 @@ public:
     sal_Bool            IsAlpha() const;
     sal_Bool            IsAnimated() const;
     sal_Bool            IsEPS() const;
-    sal_Bool            IsRenderGraphic() const;
-    sal_Bool            HasRenderGraphic() const;
 
     // #i102089# Access of Bitmap potentially will have to rasterconvert the Graphic
     // if it is a MetaFile. To be able to control this conversion it is necessary to
@@ -133,7 +132,6 @@ public:
 
     Animation               GetAnimation() const;
     const GDIMetaFile&      GetGDIMetaFile() const;
-    ::vcl::RenderGraphic    GetRenderGraphic() const;
 
 	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const;
 
@@ -217,6 +215,9 @@ public:
     virtual void        Load( SvStream& );
     virtual void        Save( SvStream& );
     virtual void        Assign( const SvDataCopyStream& );
+
+    // SvgData support
+    const SvgDataPtr& getSvgData() const;
 };
 
 #endif  // _SV_GRAPH_HXX

Modified: incubator/ooo/trunk/main/vcl/inc/vcl/metaact.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/vcl/metaact.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/vcl/metaact.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/vcl/metaact.hxx Mon Dec 19 16:41:21 2011
@@ -38,7 +38,6 @@
 #include <vcl/gdimtf.hxx>
 #include <vcl/gfxlink.hxx>
 #include <vcl/lineinfo.hxx>
-#include <vcl/rendergraphic.hxx>
 
 class SvStream;
 
@@ -99,7 +98,6 @@ class SvStream;
 #define META_LAYOUTMODE_ACTION 				(149)
 #define META_TEXTLANGUAGE_ACTION 			(150)
 #define META_OVERLINECOLOR_ACTION			(151)
-#define META_RENDERGRAPHIC_ACTION			(152)
 
 #define META_COMMENT_ACTION 				(512)
 
@@ -120,11 +118,9 @@ struct ImplMetaReadData
 struct ImplMetaWriteData
 {
 	rtl_TextEncoding        meActualCharSet;
-	GDIMetaFileWriteFlags   mnWriteFlags;
 
                             ImplMetaWriteData() :
-                                meActualCharSet( RTL_TEXTENCODING_ASCII_US ),
-                                mnWriteFlags( GDIMETAFILE_WRITE_DEFAULT )
+                                meActualCharSet( RTL_TEXTENCODING_ASCII_US )
                             {
                             }
 };
@@ -1553,41 +1549,4 @@ public:
     LanguageType		GetTextLanguage() const { return meTextLanguage; }
 };
 
-// ---------------------------
-// - MetaRenderGraphicAction -
-// ---------------------------
-
-class VCL_DLLPUBLIC MetaRenderGraphicAction : public MetaAction
-{
-private:
-
-	::vcl::RenderGraphic        maRenderGraphic;
-	Point                       maPoint;
-	Size                        maSize;
-	double						mfRotateAngle;
-	double						mfShearAngleX;
-	double						mfShearAngleY;
-
-	virtual	sal_Bool            Compare( const MetaAction& ) const;
-
-public:
-                                DECL_META_ACTION( RenderGraphic, META_RENDERGRAPHIC_ACTION )
-
-                                MetaRenderGraphicAction( const Point& rPoint, const Size& rSize,
-                                                         const vcl::RenderGraphic& rRenderData,
-                                                         double fRotateAngle = 0.0,
-                                                         double fShearAngleX = 0.0,
-                                                         double fShearAngleY = 0.0 );
-
-	virtual void                Move( long nHorzMove, long nVertMove );
-	virtual void                Scale( double fScaleX, double fScaleY );
-
-	const ::vcl::RenderGraphic& GetRenderGraphic() const { return maRenderGraphic; }
-	const Point&                GetPoint() const { return maPoint; }
-	const Size&                 GetSize() const { return maSize; }
-	double						GetRotateAngle() const { return mfRotateAngle; }
-	double						GetShearAngleX() const { return mfShearAngleX; }
-	double						GetShearAngleY() const { return mfShearAngleY; }
-};
-
 #endif // _SV_METAACT_HXX

Modified: incubator/ooo/trunk/main/vcl/inc/vcl/outdev.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/vcl/outdev.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/vcl/outdev.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/vcl/outdev.hxx Mon Dec 19 16:41:21 2011
@@ -40,6 +40,7 @@
 #include <basegfx/vector/b2enums.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <unotools/fontdefs.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
 
 #include <vector>
 
@@ -87,7 +88,6 @@ namespace basegfx {
 	class B2DHomMatrix;
 	class B2DPolygon;
     class B2DPolyPolygon;
-    typedef ::std::vector< B2DPolyPolygon > B2DPolyPolygonVector;
 }
 
 namespace com {
@@ -104,7 +104,6 @@ namespace vcl
     class PDFWriterImpl;
     class ExtOutDevData;
     class ITextLayout;
-    class RenderGraphic;
 }
 
 #define OUTDEV_BUFFER_SIZE  128
@@ -813,9 +812,6 @@ public:
     bool                DrawEPS( const Point& rPt, const Size& rSz,
                                  const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
 
-    void                DrawRenderGraphic( const Point& rPt, const Size& rSz,
-                                           const ::vcl::RenderGraphic& rRenderGraphic );
-
     Color               GetPixel( const Point& rPt ) const;
     Color*              GetPixel( const Polygon& rPts ) const;
 

Modified: incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx Mon Dec 19 16:41:21 2011
@@ -37,6 +37,7 @@
 #include <vcl/virdev.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/graphictools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
 
 // -----------
 // - Defines -
@@ -1445,15 +1446,6 @@ void GDIMetaFile::Rotate( long nAngle10 
 			    }
 			    break;
 
-			    case( META_RENDERGRAPHIC_ACTION ):
-                {
-                    OSL_TRACE( "Rotate not supported for RenderGraphic MetaActions yet" );
-
-				    pAction->Duplicate();
-				    aMtf.AddAction( pAction );
-                }
-                break;
-
 			    default:
 			    {
                     pAction->Execute( &aMapVDev );
@@ -1876,14 +1868,6 @@ Rectangle GDIMetaFile::GetBoundRect( Out
         }
         break;
 
-        case( META_RENDERGRAPHIC_ACTION ):
-        {
-            MetaRenderGraphicAction* pAct = (MetaRenderGraphicAction*) pAction;
-            Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
-            ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
-        }
-        break;
-
         default:
             {
                 pAction->Execute( &aMapVDev );
@@ -2282,15 +2266,6 @@ void GDIMetaFile::ImplExchangeColors( Co
 			}
 			break;
 
-            case( META_RENDERGRAPHIC_ACTION ):
-            {
-                OSL_TRACE( "ExchangeColors not supported for RenderGraphic MetaActions yet" );
-
-				pAction->Duplicate();
-				aMtf.Insert( pAction, LIST_APPEND );
-            }
-            break;
-
 			default:
 			{
 				pAction->Duplicate();
@@ -2739,27 +2714,70 @@ sal_uLong GDIMetaFile::GetChecksum() con
 			}
 			break;
 
-            case( META_RENDERGRAPHIC_ACTION ):
+            case META_CLIPREGION_ACTION :
             {
-                MetaRenderGraphicAction*    pAct = (MetaRenderGraphicAction*) pAction;
-				const ::vcl::RenderGraphic& rRenderGraphic = pAct->GetRenderGraphic();
+                MetaClipRegionAction* pAct = dynamic_cast< MetaClipRegionAction* >(pAction);
+                const Region& rRegion = pAct->GetRegion();
 
-				ShortToSVBT16( pAct->GetType(), aBT16 );
-				nCrc = rtl_crc32( nCrc, aBT16, 2 );
+                if(rRegion.HasPolyPolygon())
+                {
+                    // It has shown that this is a possible bottleneck for checksum calculation.
+                    // In worst case a very expensive RegionHandle representation gets created.
+                    // In this case it's cheaper to use the PolyPolygon
+                    const basegfx::B2DPolyPolygon aPolyPolygon(rRegion.GetB2DPolyPolygon());
+                    const sal_uInt32 nPolyCount(aPolyPolygon.count());
+                    SVBT64 aSVBT64;
 
-				nCrc = rtl_crc32( nCrc, rRenderGraphic.GetGraphicData().get(), rRenderGraphic.GetGraphicDataLength() );
+                    for(sal_uInt32 a(0); a < nPolyCount; a++)
+                    {
+                        const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a));
+                        const sal_uInt32 nPointCount(aPolygon.count());
+                        const bool bControl(aPolygon.areControlPointsUsed());
+                        
+                        for(sal_uInt32 b(0); b < nPointCount; b++)
+                        {
+                            const basegfx::B2DPoint aPoint(aPolygon.getB2DPoint(b));
 
-				UInt32ToSVBT32( pAct->GetPoint().X(), aBT32 );
-				nCrc = rtl_crc32( nCrc, aBT32, 4 );
+                            DoubleToSVBT64(aPoint.getX(), aSVBT64);
+                            nCrc = rtl_crc32(nCrc, aSVBT64, 8);
+                            DoubleToSVBT64(aPoint.getY(), aSVBT64);
+                            nCrc = rtl_crc32(nCrc, aSVBT64, 8);
 
-				UInt32ToSVBT32( pAct->GetPoint().Y(), aBT32 );
-				nCrc = rtl_crc32( nCrc, aBT32, 4 );
+                            if(bControl)
+                            {
+                                if(aPolygon.isPrevControlPointUsed(b))
+                                {
+                                    const basegfx::B2DPoint aCtrl(aPolygon.getPrevControlPoint(b));
 
-				UInt32ToSVBT32( pAct->GetSize().Width(), aBT32 );
-				nCrc = rtl_crc32( nCrc, aBT32, 4 );
+                                    DoubleToSVBT64(aCtrl.getX(), aSVBT64);
+                                    nCrc = rtl_crc32(nCrc, aSVBT64, 8);
+                                    DoubleToSVBT64(aCtrl.getY(), aSVBT64);
+                                    nCrc = rtl_crc32(nCrc, aSVBT64, 8);
+                                }
 
-				UInt32ToSVBT32( pAct->GetSize().Height(), aBT32 );
-				nCrc = rtl_crc32( nCrc, aBT32, 4 );
+                                if(aPolygon.isNextControlPointUsed(b))
+                                {
+                                    const basegfx::B2DPoint aCtrl(aPolygon.getNextControlPoint(b));
+
+                                    DoubleToSVBT64(aCtrl.getX(), aSVBT64);
+                                    nCrc = rtl_crc32(nCrc, aSVBT64, 8);
+                                    DoubleToSVBT64(aCtrl.getY(), aSVBT64);
+                                    nCrc = rtl_crc32(nCrc, aSVBT64, 8);
+                                }
+                            }
+                        }
+                    }
+
+                    SVBT8 aSVBT8;
+                    ByteToSVBT8((sal_uInt8)pAct->IsClipping(), aSVBT8);
+                    nCrc = rtl_crc32(nCrc, aSVBT8, 1);
+                }
+                else
+                {
+                    pAction->Write( aMemStm, &aWriteData );
+                    nCrc = rtl_crc32( nCrc, aMemStm.GetData(), aMemStm.Tell() );
+                    aMemStm.Seek( 0 );
+                }
             }
             break;
 
@@ -2828,8 +2846,6 @@ sal_uLong GDIMetaFile::GetSizeBytes() co
                     nSizeBytes += ( pTextArrayAction->GetLen() << 2 );
             }
             break;
-
-            case( META_RENDERGRAPHIC_ACTION ): nSizeBytes += ( ( (MetaRenderGraphicAction*) pAction )->GetRenderGraphic() ).GetGraphicDataLength(); break;
         }
     }
 
@@ -2857,63 +2873,27 @@ SvStream& operator>>( SvStream& rIStm, G
 			// new format
 			VersionCompat*	pCompat;
 			MetaAction* 	pAction;
-			sal_uInt32		nStmCompressMode = 0;
-			sal_uInt32		nCount = 0;
-			sal_uInt8		bRenderGraphicReplacements = 0;
+			sal_uInt32			nStmCompressMode = 0;
+			sal_uInt32			nCount = 0;
 
 			pCompat = new VersionCompat( rIStm, STREAM_READ );
-			{
-				// version 1
-				rIStm >> nStmCompressMode;
-				rIStm >> rGDIMetaFile.aPrefMapMode;
-				rIStm >> rGDIMetaFile.aPrefSize;
-				rIStm >> nCount;
 
-				if( pCompat->GetVersion() >= 2 )
-				{
-					// version 2
-					// =========
-					// contains an additional flag to indicate that RenderGraphic
-					// actions are immediately followed by a replacement image, that
-					// needs to be skipped in case the flag is set (KA 01/2011)
+			rIStm >> nStmCompressMode;
+			rIStm >> rGDIMetaFile.aPrefMapMode;
+			rIStm >> rGDIMetaFile.aPrefSize;
+			rIStm >> nCount;
 
-					rIStm >> bRenderGraphicReplacements;
-				}
-			}
 			delete pCompat;
 
 			ImplMetaReadData aReadData;
 			aReadData.meActualCharSet = rIStm.GetStreamCharSet();
 
-			for( sal_uInt32 nAction = 0UL; ( nAction < nCount ) && !rIStm.IsEof(); ++nAction )
+			for( sal_uInt32 nAction = 0UL; ( nAction < nCount ) && !rIStm.IsEof(); nAction++ )
 			{
 				pAction = MetaAction::ReadMetaAction( rIStm, &aReadData );
 
 				if( pAction )
-				{
 					rGDIMetaFile.AddAction( pAction );
-
-					// if the MetaFile was written in RenderGraphics replacement mode
-					// and we just read a RenderGraphic action, skip the following
-					// META_BMPEXSCALE_ACTION, since this is the replacement image,
-					// just needed for old implementations; don't forget to increment
-					// the action read counter! (KA 01/2011)
-					if( bRenderGraphicReplacements &&
-						( META_RENDERGRAPHIC_ACTION == pAction->GetType() ) &&
-						( ++nAction < nCount ) && !rIStm.IsEof() )
-					{
-						sal_uInt16 nFollowingType;
-						
-						// dummy read of the next following META_BMPEXSCALE_ACTION
-						// RenderGraphic replacement action (KA 01/2011)
-						rIStm >> nFollowingType;
-						delete ( new VersionCompat( rIStm, STREAM_READ ) );
-
-						OSL_ENSURE( META_BMPEXSCALE_ACTION == nFollowingType, \
-"META_RENDERGRAPHIC_ACTION read in RenderGraphic replacement mode \
-without following META_BMPEXSCALE_ACTION replacement" );
-					}
-				}
 			}
 		}
 		else
@@ -2980,90 +2960,32 @@ SvStream& GDIMetaFile::Read( SvStream& r
 
 // ------------------------------------------------------------------------
 
-SvStream& GDIMetaFile::Write( SvStream& rOStm, GDIMetaFileWriteFlags nWriteFlags )
+SvStream& GDIMetaFile::Write( SvStream& rOStm )
 {
 	VersionCompat*	pCompat;
-	const sal_uInt32    nStmCompressMode = rOStm.GetCompressMode();
-	sal_uInt16		    nOldFormat = rOStm.GetNumberFormatInt();
-	const 			    sal_uInt8 bRenderGraphicReplacements =
-								( ( ( GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC & nWriteFlags ) != 0 ) ? 1 : 0 );
-
-	// With the introduction of the META_RENDERGRAPHIC_ACTION, it is neccessary
-	// to provide some kind of document backward compatibility:
-	// 
-	//	If the flag GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC is set in
-	//	parameter nWriteFlags, each META_RENDERGRAPHIC_ACTION is followed by
-	//  an additional META_BMPEXSCALE_ACTION, that contains a replacement
-	//	image for the new RenderGraphic action.
-	//
-	//	Old implementations, not knowing anything about META_RENDERGRAPHIC_ACTION,
-	//  will skip this new action and read the META_BMPEXSCALE_ACTION instead
-	//
-	//  Since the current implementation is able to handle the new action, the
-	//  then following image replacement action needs to be skipped by this
-	//  implementation, if the metafile was written in the RenderGraphic
-	//  replacement mode.
-	//
-	//  To be able to detect this compatibility mode, the header needs to
-	//  be extended by a corresponding flag, resulting in version 2 of
-	//  the header. The surrounding VersionCompat of the header
-	//  allows to add such new data without any problems (KA 01/2011)
+	const sal_uInt32	nStmCompressMode = rOStm.GetCompressMode();
+	sal_uInt16			nOldFormat = rOStm.GetNumberFormatInt();
 
 	rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
 	rOStm.Write( "VCLMTF", 6 );
 
-	pCompat = new VersionCompat( rOStm, STREAM_WRITE, 2 );
-
-	{
-		// version 1
-		sal_uInt32 nActionCount = 0;
-
-		// calculate correct action count and watch for
-		// additional RenderGraphic replacement actions, if the 
-		// GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC is set
-		// and META_RENDERGRAPHIC_ACTION are encountered (KA 01/2011)
-		for( MetaAction* pAct = static_cast< MetaAction* >( First() ); pAct; pAct = static_cast< MetaAction* >( Next() ) )
-		{
-			nActionCount += ( bRenderGraphicReplacements && ( META_RENDERGRAPHIC_ACTION == pAct->GetType() ) ? 2 : 1 );
-		}
-		
-		rOStm << nStmCompressMode << aPrefMapMode << aPrefSize << nActionCount;
+	pCompat = new VersionCompat( rOStm, STREAM_WRITE, 1 );
 
-		{
-			// version 2
-			// =========
-			// since version 2, a GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC flag
-			// is written, to indicate that each META_BMPEXSCALE_ACTION following
-			// a META_RENDERGRAPHIC_ACTION needs to be skipped, in case the flag is
-			// set (KA 01/2011)
-			rOStm << bRenderGraphicReplacements;
-		}
-	}
+	rOStm << nStmCompressMode;
+	rOStm << aPrefMapMode;
+	rOStm << aPrefSize;
+	rOStm << (sal_uInt32) GetActionCount();
 
 	delete pCompat;
 
 	ImplMetaWriteData aWriteData;
-
 	aWriteData.meActualCharSet = rOStm.GetStreamCharSet();
-	aWriteData.mnWriteFlags = nWriteFlags;
 
-	for( MetaAction* pAct = static_cast< MetaAction* >( First() ); pAct; pAct = static_cast< MetaAction* >( Next() ) )
+	MetaAction* pAct = (MetaAction*)First();
+	while ( pAct )
 	{
 		pAct->Write( rOStm, &aWriteData );
-
-		// write the RenderGraphic replacement image, if the
-		// GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC flag is set
-		// and if a META_RENDERGRAPHIC_ACTION is encountered (KA 01/2011)
-		if( bRenderGraphicReplacements && ( META_RENDERGRAPHIC_ACTION == pAct->GetType() ) )
-		{
-			MetaRenderGraphicAction* 	pRenderAction = static_cast< MetaRenderGraphicAction* >( pAct );
-			MetaBmpExScaleAction*		pBmpExScaleAction = new MetaBmpExScaleAction(
-											pRenderAction->GetPoint(), pRenderAction->GetSize(),
-											pRenderAction->GetRenderGraphic().GetReplacement() );
-
-			pBmpExScaleAction->Write( rOStm, &aWriteData );
-			pBmpExScaleAction->Delete();
-		}
+		pAct = (MetaAction*)Next();
 	}
 
 	rOStm.SetNumberFormatInt( nOldFormat );

Modified: incubator/ooo/trunk/main/vcl/source/gdi/graph.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/graph.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/graph.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/graph.cxx Mon Dec 19 16:41:21 2011
@@ -27,11 +27,9 @@
 #include <vcl/outdev.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/graph.hxx>
-
+#include <vcl/metaact.hxx>
 #include <impgraph.hxx>
-
 #include <comphelper/processfactory.hxx>
-
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -244,6 +242,13 @@ Graphic::Graphic( const BitmapEx& rBmpEx
 
 // ------------------------------------------------------------------------
 
+Graphic::Graphic(const SvgDataPtr& rSvgDataPtr)
+{
+    mpImpGraphic = new ImpGraphic(rSvgDataPtr);
+}
+
+// ------------------------------------------------------------------------
+
 Graphic::Graphic( const Animation& rAnimation )
 {
     mpImpGraphic = new ImpGraphic( rAnimation );
@@ -434,20 +439,6 @@ sal_Bool Graphic::IsEPS() const
 
 // ------------------------------------------------------------------------
 
-sal_Bool Graphic::IsRenderGraphic() const
-{
-    return mpImpGraphic->ImplIsRenderGraphic();
-}
-
-// ------------------------------------------------------------------------
-
-sal_Bool Graphic::HasRenderGraphic() const
-{
-    return mpImpGraphic->ImplHasRenderGraphic();
-}
-
-// ------------------------------------------------------------------------
-
 Bitmap Graphic::GetBitmap(const GraphicConversionParameters& rParameters) const
 {
     return mpImpGraphic->ImplGetBitmap(rParameters);
@@ -476,13 +467,6 @@ const GDIMetaFile& Graphic::GetGDIMetaFi
 
 // ------------------------------------------------------------------------
 
-::vcl::RenderGraphic Graphic::GetRenderGraphic() const
-{
-    return mpImpGraphic->ImplGetRenderGraphic();
-}
-
-// ------------------------------------------------------------------------
-
 uno::Reference< graphic::XGraphic > Graphic::GetXGraphic() const
 {
 	uno::Reference< graphic::XGraphic > xRet;
@@ -840,3 +824,8 @@ SvStream& operator<<( SvStream& rOStream
 {
     return rOStream << *rGraphic.mpImpGraphic;
 }
+
+const SvgDataPtr& Graphic::getSvgData() const 
+{ 
+    return mpImpGraphic->getSvgData();
+}

Modified: incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx Mon Dec 19 16:41:21 2011
@@ -175,6 +175,8 @@ ImpGraphic::ImpGraphic( const ImpGraphic
     }
     else
         mpAnimation = NULL;
+
+    maSvgData = rImpGraphic.maSvgData;
 }
 
 // ------------------------------------------------------------------------
@@ -213,6 +215,23 @@ ImpGraphic::ImpGraphic( const BitmapEx& 
 
 // ------------------------------------------------------------------------
 
+ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr) 
+:   mpAnimation( NULL ),
+    mpContext( NULL ),
+    mpSwapFile( NULL ),
+    mpGfxLink( NULL ),
+    meType( rSvgDataPtr.get() ? GRAPHIC_BITMAP : GRAPHIC_NONE ),
+    mnDocFilePos( 0UL ),
+    mnSizeBytes( 0UL ),
+    mnRefCount( 1UL ),
+    mbSwapOut( sal_False ),
+    mbSwapUnderway( sal_False ),
+    maSvgData(rSvgDataPtr)
+{
+}
+
+// ------------------------------------------------------------------------
+
 ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
 	    maEx			( rAnimation.GetBitmapEx() ),
 	    mpAnimation		( new Animation( rAnimation ) ),
@@ -298,6 +317,8 @@ ImpGraphic& ImpGraphic::operator=( const
 			mpGfxLink = new GfxLink( *rImpGraphic.mpGfxLink );
 		else
 			mpGfxLink = NULL;
+
+        maSvgData = rImpGraphic.maSvgData;
 	}
 
 	return *this;
@@ -328,13 +349,35 @@ sal_Bool ImpGraphic::operator==( const I
 
 			case( GRAPHIC_BITMAP ):
 			{
-				if( mpAnimation )
+                if(maSvgData.get())
+                {
+                    if(maSvgData == rImpGraphic.maSvgData)
+                    {
+                        bRet = sal_True;
+                    }
+                    else if(rImpGraphic.maSvgData)
+                    {
+                        if(maSvgData->getSvgDataArrayLength() == rImpGraphic.maSvgData->getSvgDataArrayLength())
+                        {
+                            if(0 == memcmp(
+                                maSvgData->getSvgDataArray().get(), 
+                                rImpGraphic.maSvgData->getSvgDataArray().get(), 
+                                maSvgData->getSvgDataArrayLength()))
+                            {
+                                bRet = sal_True;
+                            }
+                        }
+                    }
+                }
+				else if( mpAnimation )
 				{
 					if( rImpGraphic.mpAnimation && ( *rImpGraphic.mpAnimation == *mpAnimation ) )
 						bRet = sal_True;
 				}
 				else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maEx == maEx ) )
+                {
 					bRet = sal_True;
+                }
 			}
 			break;
 
@@ -371,6 +414,8 @@ void ImpGraphic::ImplClearGraphics( sal_
 		delete mpGfxLink;
 		mpGfxLink = NULL;
 	}
+
+    maSvgData.reset();
 }
 
 // ------------------------------------------------------------------------
@@ -446,12 +491,12 @@ sal_Bool ImpGraphic::ImplIsSupportedGrap
 
 sal_Bool ImpGraphic::ImplIsTransparent() const
 {
-	sal_Bool bRet;
+	sal_Bool bRet(sal_True);
 
-    if( meType == GRAPHIC_BITMAP )
+    if( meType == GRAPHIC_BITMAP && !maSvgData.get())
+    {
 		bRet = ( mpAnimation ? mpAnimation->IsTransparent() : maEx.IsTransparent() );
-    else
-		bRet = sal_True;
+    }
 
 	return bRet;
 }
@@ -460,12 +505,16 @@ sal_Bool ImpGraphic::ImplIsTransparent()
 
 sal_Bool ImpGraphic::ImplIsAlpha() const
 {
-	sal_Bool bRet;
+	sal_Bool bRet(sal_False);
 
-    if( meType == GRAPHIC_BITMAP )
+    if(maSvgData.get())
+    {
+        bRet = sal_True;
+    }
+    else if( meType == GRAPHIC_BITMAP )
+    {
 		bRet = ( NULL == mpAnimation ) && maEx.IsAlpha();
-    else
-		bRet = sal_False;
+    }
 
 	return bRet;
 }
@@ -488,45 +537,18 @@ sal_Bool ImpGraphic::ImplIsEPS() const
 
 // ------------------------------------------------------------------------
 
-sal_Bool ImpGraphic::ImplIsRenderGraphic() const
-{
-    return( ( GRAPHIC_GDIMETAFILE == meType ) &&
-            ( 1 == maMetaFile.GetActionCount() ) &&
-            ( META_RENDERGRAPHIC_ACTION == maMetaFile.GetAction( 0 )->GetType() ) );
-}
-
-// ------------------------------------------------------------------------
-
-sal_Bool ImpGraphic::ImplHasRenderGraphic() const
-{   
-    sal_Bool bRet = sal_False;
-
-    if( GRAPHIC_GDIMETAFILE == meType )
-    {
-        GDIMetaFile& rMtf = const_cast< ImpGraphic* >( this )->maMetaFile;
-
-        for( MetaAction* pAct = rMtf.FirstAction(); pAct && !bRet; pAct = rMtf.NextAction() )
-        {
-            if( META_RENDERGRAPHIC_ACTION == pAct->GetType() )
-            {
-                bRet = sal_True;
-            }
-        }
-
-        rMtf.WindStart();
-    }
-    
-    return( bRet );
-}
-
-// ------------------------------------------------------------------------
-
 Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters) const
 {
     Bitmap aRetBmp;
 
     if( meType == GRAPHIC_BITMAP )
     {
+        if(maSvgData.get() && maEx.IsEmpty())
+        {
+            // use maEx as local buffer for rendered svg
+            const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
+        }
+
 		const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
 		const Color		aReplaceColor( COL_WHITE );
 
@@ -605,6 +627,12 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(con
 
     if( meType == GRAPHIC_BITMAP )
     {
+        if(maSvgData.get() && maEx.IsEmpty())
+        {
+            // use maEx as local buffer for rendered svg
+            const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
+        }
+
 		aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
 
         if(rParameters.getSizePixel().Width() || rParameters.getSizePixel().Height())
@@ -633,18 +661,6 @@ Animation ImpGraphic::ImplGetAnimation()
 
 // ------------------------------------------------------------------------
 
-::vcl::RenderGraphic ImpGraphic::ImplGetRenderGraphic() const
-{
-    ::vcl::RenderGraphic aRet;
-
-    if( ImplIsRenderGraphic() )
-        aRet = static_cast< MetaRenderGraphicAction* >( maMetaFile.GetAction( 0 ) )->GetRenderGraphic();
-
-    return( aRet );
-}
-
-// ------------------------------------------------------------------------
-
 const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
 {
 	return maMetaFile;
@@ -668,10 +684,22 @@ Size ImpGraphic::ImplGetPrefSize() const
 
 			case( GRAPHIC_BITMAP ):
 			{
-				aSize = maEx.GetPrefSize();
-
-				if( !aSize.Width() || !aSize.Height() )
-					aSize = maEx.GetSizePixel();
+                if(maSvgData.get() && maEx.IsEmpty())
+                {
+                    // svg not yet buffered in maEx, return size derived from range
+                    const basegfx::B2DRange& rRange = maSvgData->getRange();
+
+                    aSize = Size(basegfx::fround(rRange.getWidth()), basegfx::fround(rRange.getHeight()));
+                }
+                else
+                {
+                    aSize = maEx.GetPrefSize();
+
+				    if( !aSize.Width() || !aSize.Height() )
+                    {
+					    aSize = maEx.GetSizePixel();
+                    }
+                }
 			}
 			break;
 
@@ -698,12 +726,24 @@ void ImpGraphic::ImplSetPrefSize( const 
 		break;
 
 		case( GRAPHIC_BITMAP ):
+        {
             // #108077# Push through pref size to animation object,
             // will be lost on copy otherwise
-            if( ImplIsAnimated() )
-                const_cast< BitmapEx& >(mpAnimation->GetBitmapEx()).SetPrefSize( rPrefSize );
+            if(maSvgData.get())
+            {
+                // ignore for Svg. If this is really used (except the grfcache)
+                // it can be extended by using maEx as buffer for maSvgData->getReplacement()
+            }
+            else
+            {
+                if( ImplIsAnimated() )
+                {
+                    const_cast< BitmapEx& >(mpAnimation->GetBitmapEx()).SetPrefSize( rPrefSize );
+                }
 
-            maEx.SetPrefSize( rPrefSize );
+                maEx.SetPrefSize( rPrefSize );
+            }
+        }
 		break;
 
         default:
@@ -733,10 +773,18 @@ MapMode ImpGraphic::ImplGetPrefMapMode()
 
 			case( GRAPHIC_BITMAP ):
 			{
-				const Size aSize( maEx.GetPrefSize() );
-
-				if ( aSize.Width() && aSize.Height() )
-					aMapMode = maEx.GetPrefMapMode();
+                if(maSvgData.get() && maEx.IsEmpty())
+                {
+                    // svg not yet buffered in maEx, return default PrefMapMode
+                    aMapMode = MapMode(MAP_100TH_MM);
+                }
+                else
+                {
+				    const Size aSize( maEx.GetPrefSize() );
+
+				    if ( aSize.Width() && aSize.Height() )
+					    aMapMode = maEx.GetPrefMapMode();
+                }
 			}
 			break;
 
@@ -763,12 +811,24 @@ void ImpGraphic::ImplSetPrefMapMode( con
 		break;
 
 		case( GRAPHIC_BITMAP ):
-            // #108077# Push through pref mapmode to animation object,
-            // will be lost on copy otherwise
-            if( ImplIsAnimated() )
-                const_cast< BitmapEx& >(mpAnimation->GetBitmapEx()).SetPrefMapMode( rPrefMapMode );
+        {
+            if(maSvgData.get())
+            {
+                // ignore for Svg. If this is really used (except the grfcache)
+                // it can be extended by using maEx as buffer for maSvgData->getReplacement()
+            }
+            else
+            {
+                // #108077# Push through pref mapmode to animation object,
+                // will be lost on copy otherwise
+                if( ImplIsAnimated() )
+                {
+                    const_cast< BitmapEx& >(mpAnimation->GetBitmapEx()).SetPrefMapMode( rPrefMapMode );
+                }
 
-			maEx.SetPrefMapMode( rPrefMapMode );
+			    maEx.SetPrefMapMode( rPrefMapMode );
+            }
+        }
 		break;
 
         default:
@@ -788,7 +848,14 @@ sal_uLong ImpGraphic::ImplGetSizeBytes()
     {
         if( meType == GRAPHIC_BITMAP )
 	    {
-            mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maEx.GetSizeBytes();
+            if(maSvgData.get())
+            {
+                mnSizeBytes = maSvgData->getSvgDataArrayLength();
+            }
+            else
+            {
+                mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maEx.GetSizeBytes();
+            }
         }
         else if( meType == GRAPHIC_GDIMETAFILE )
         {
@@ -812,10 +879,20 @@ void ImpGraphic::ImplDraw( OutputDevice*
 
 			case( GRAPHIC_BITMAP ):
 			{
-				if ( mpAnimation )
+                if(maSvgData.get() && !maEx)
+                {
+                    // use maEx as local buffer for rendered svg
+                    const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
+                }
+
+                if ( mpAnimation )
+                {
 					mpAnimation->Draw( pOutDev, rDestPt );
+                }
 				else
+                {
 					maEx.Draw( pOutDev, rDestPt );
+                }
 			}
 			break;
 
@@ -840,10 +917,20 @@ void ImpGraphic::ImplDraw( OutputDevice*
 
 			case( GRAPHIC_BITMAP ):
 			{
-				if( mpAnimation )
+                if(maSvgData.get() && maEx.IsEmpty())
+                {
+                    // use maEx as local buffer for rendered svg
+                    const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
+                }
+				
+                if( mpAnimation )
+                {
 					mpAnimation->Draw( pOutDev, rDestPt, rDestSize );
+                }
 				else
+                {
 					maEx.Draw( pOutDev, rDestPt, rDestSize );
+                }
 			}
 			break;
 
@@ -1052,7 +1139,13 @@ sal_Bool ImpGraphic::ImplReadEmbedded( S
 	{
 		if( meType == GRAPHIC_BITMAP )
 		{
-			maEx.aBitmapSize = aSize;
+            if(maSvgData.get() && maEx.IsEmpty())
+            {
+                // use maEx as local buffer for rendered svg
+                maEx = maSvgData->getReplacement();
+            }
+
+            maEx.aBitmapSize = aSize;
 
 			if( aMapMode != MapMode() )
 			{
@@ -1510,10 +1603,20 @@ sal_uLong ImpGraphic::ImplGetChecksum() 
 
 			case( GRAPHIC_BITMAP ):
 			{
-				if( mpAnimation )
+                if(maSvgData.get() && maEx.IsEmpty())
+                {
+                    // use maEx as local buffer for rendered svg
+                    const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
+                }
+				
+                if( mpAnimation )
+                {
 					nRet = mpAnimation->GetChecksum();
+                }
 				else
+                {
 					nRet = maEx.GetChecksum();
+                }
 			}
 			break;
 
@@ -1553,6 +1656,13 @@ sal_Bool ImpGraphic::ImplExportNative( S
 
 // ------------------------------------------------------------------------
 
+const SvgDataPtr& ImpGraphic::getSvgData() const 
+{ 
+    return maSvgData; 
+}
+
+// ------------------------------------------------------------------------
+
 SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic )
 {
 	if( !rIStm.GetError() )
@@ -1704,10 +1814,18 @@ SvStream& operator<<( SvStream& rOStm, c
 
 					case GRAPHIC_BITMAP:
 					{
-						if ( rImpGraphic.ImplIsAnimated() )
+                        if(rImpGraphic.getSvgData().get())
+                        {
+                            rOStm << rImpGraphic.getSvgData()->getReplacement();
+                        }
+						else if( rImpGraphic.ImplIsAnimated())
+                        {
 							rOStm << *rImpGraphic.mpAnimation;
+                        }
 						else
+                        {
 							rOStm << rImpGraphic.maEx;
+                        }
 					}
 					break;
 

Modified: incubator/ooo/trunk/main/vcl/source/gdi/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/makefile.mk?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/makefile.mk (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/makefile.mk Mon Dec 19 16:41:21 2011
@@ -76,9 +76,7 @@ EXCEPTIONSFILES=	$(SLO)$/salmisc.obj		\
 			$(SLO)$/graphictools.obj	\
 			$(SLO)$/textlayout.obj		\
 			$(SLO)$/lineinfo.obj		\
-			$(SLO)$/svgread.obj		\
-			$(SLO)$/rendergraphic.obj	\
-			$(SLO)$/rendergraphicrasterizer.obj
+			$(SLO)$/svgdata.obj
 
 SLOFILES=	$(EXCEPTIONSFILES)		\
 			$(SLO)$/animate.obj 	\