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/16 17:59:37 UTC

svn commit: r1215221 - in /incubator/ooo/branches/alg/svgreplacement/main: drawinglayer/source/primitive2d/ drawinglayer/source/tools/ sd/source/ui/view/ svx/inc/svx/ svx/source/sdr/primitive2d/ svx/source/svdraw/

Author: alg
Date: Fri Dec 16 16:59:36 2011
New Revision: 1215221

URL: http://svn.apache.org/viewvc?rev=1215221&view=rev
Log:
svg: moved Svg primitive usage from SdrGrafPrimitive to GrafPrimitive to support cropping at Svg image objects; Added direct break support for Svg images; Added direct ConvertToBitmap support to Svg Images; simlified some Svg usages by adding tooling methods to SdrGrafObj

Modified:
    incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/cropprimitive2d.cxx
    incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
    incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/tools/converters.cxx
    incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews2.cxx
    incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews7.cxx
    incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsc.cxx
    incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsj.cxx
    incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/sdview.cxx
    incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdograf.hxx
    incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdxcgv.hxx
    incubator/ooo/branches/alg/svgreplacement/main/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
    incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv.cxx
    incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv2.cxx
    incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdograf.cxx
    incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdxcgv.cxx

Modified: incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/cropprimitive2d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/cropprimitive2d.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/cropprimitive2d.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/cropprimitive2d.cxx Fri Dec 16 16:59:36 2011
@@ -137,10 +137,9 @@ namespace drawinglayer
                 {
                     // nothing to return since cropped content is completely empty
                 }
-                else if(aCurrent.isInside(aCropped))
+                else if(aCurrent.equal(aCropped))
                 {
-                    // crop just shrunk so that its inside content, 
-                    // no need to use a mask since not really cropped.
+                    // no crop, just use content
                     xRetval = getChildren();
                 }
                 else
@@ -167,17 +166,26 @@ namespace drawinglayer
                             aNewObjectTransform, 
                             getChildren()));
 
-                    // mask with original object's bounds
-                    basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createUnitPolygon());
-                    aMaskPolyPolygon.transform(getTransformation());
-
-                    // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector
-                    const Primitive2DReference xMask(
-                        new MaskPrimitive2D(
-                            aMaskPolyPolygon, 
-                            Primitive2DSequence(&xTransformPrimitive, 1)));
+                    if(aCurrent.isInside(aCropped))
+                    {
+                        // crop just shrunk so that its inside content, 
+                        // no need to use a mask since not really cropped.
+                        xRetval = Primitive2DSequence(&xTransformPrimitive, 1);
+                    }
+                    else
+                    {
+                        // mask with original object's bounds
+                        basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createUnitPolygon());
+                        aMaskPolyPolygon.transform(getTransformation());
+
+                        // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector
+                        const Primitive2DReference xMask(
+                            new MaskPrimitive2D(
+                                aMaskPolyPolygon, 
+                                Primitive2DSequence(&xTransformPrimitive, 1)));
 
-                    xRetval = Primitive2DSequence(&xMask, 1);
+                        xRetval = Primitive2DSequence(&xMask, 1);
+                    }
                 }
             }
 

Modified: incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/graphicprimitive2d.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/graphicprimitive2d.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/primitive2d/graphicprimitive2d.cxx Fri Dec 16 16:59:36 2011
@@ -35,7 +35,6 @@
 #include <drawinglayer/primitive2d/cropprimitive2d.hxx>
 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
 #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
-#include <drawinglayer/primitive2d/cropprimitive2d.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 // helper class for animated graphics
@@ -294,6 +293,32 @@ namespace drawinglayer
 								xPrimitive = Primitive2DReference(new AnimatedSwitchPrimitive2D(aAnimationList, aBitmapPrimitives, false));
 							}
 						}
+                        else if(aTransformedGraphic.getSvgData().get())
+                        {
+                            // embedded Svg fill, create embed transform
+                            const basegfx::B2DRange& rSvgRange(aTransformedGraphic.getSvgData()->getRange());
+
+                            if(basegfx::fTools::more(rSvgRange.getWidth(), 0.0) && basegfx::fTools::more(rSvgRange.getHeight(), 0.0))
+                            {
+                                // translate back to origin, scale to unit coordinates
+                                basegfx::B2DHomMatrix aEmbedSvg(
+                                    basegfx::tools::createTranslateB2DHomMatrix(
+                                        -rSvgRange.getMinX(),
+                                        -rSvgRange.getMinY()));
+
+                                aEmbedSvg.scale(
+                                    1.0 / rSvgRange.getWidth(),
+                                    1.0 / rSvgRange.getHeight());
+
+                                // apply created object transformation
+                                aEmbedSvg = aTransform * aEmbedSvg;
+
+                                // add Svg primitives embedded
+                                xPrimitive = new TransformPrimitive2D(
+                                    aEmbedSvg,
+                                    aTransformedGraphic.getSvgData()->getPrimitive2DSequence());
+                            }
+                        }
 						else
 						{
 							xPrimitive = Primitive2DReference(new BitmapPrimitive2D(aTransformedGraphic.GetBitmapEx(), aTransform));

Modified: incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/tools/converters.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/tools/converters.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/tools/converters.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/drawinglayer/source/tools/converters.cxx Fri Dec 16 16:59:36 2011
@@ -82,6 +82,10 @@ namespace drawinglayer
                 maContent.SetMapMode(aMapModePixel);
                 maContent.SetAntialiasing(true);
 
+                // set to all white
+                maContent.SetBackground(Wallpaper(Color(COL_WHITE)));
+                maContent.Erase();
+
                 // create processor
                 processor2d::VclPixelProcessor2D aContentProcessor(aViewInformation2D, maContent);
 
@@ -97,7 +101,6 @@ namespace drawinglayer
                 maContent.SetAntialiasing(true);
 
                 // set alpha to all white (fully transparent)
-                maContent.SetBackground(Wallpaper(Color(COL_WHITE)));
                 maContent.Erase();
 
                 // embed primitives to paint them black

Modified: incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews2.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews2.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews2.cxx Fri Dec 16 16:59:36 2011
@@ -627,7 +627,9 @@ void DrawViewShell::FuTemporary(SfxReque
 				else
 				{
 					if( mpDrawView->IsVectorizeAllowed() )
+                    {
 						SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+                    }
 					else
 					{
 						WaitObject aWait( (Window*)GetActiveWindow() );
@@ -709,8 +711,31 @@ void DrawViewShell::FuTemporary(SfxReque
 					break;
 					case SID_CONVERT_TO_BITMAP:
 					{
-						Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
-						aGraphic = Graphic(aBitmap);
+                        bool bDone(false);
+                        
+                        // I have to get the image here directly since GetAllMarkedBitmap works
+                        // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
+                        // channel. Argh! GetAllMarkedBitmap itself is too widely used to safely
+                        // change that, e.g. in the exchange formats. For now I can only add this 
+                        // exception to get good results for Svgs. This is how the code gets more 
+                        // and more crowded, at last I made a remark for myself to change this
+                        // as one of the next tasks.
+                        if(1 == mpDrawView->GetMarkedObjectCount())
+                        {
+                            const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0));
+
+                            if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
+                            {
+                                aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement());
+                                bDone = true;
+                            }
+                        }
+
+                        if(!bDone)
+                        {
+                            Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
+                            aGraphic = Graphic(aBitmap);
+                        }
 					}
 					break;
 				}

Modified: incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews7.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews7.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews7.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviews7.cxx Fri Dec 16 16:59:36 2011
@@ -1426,11 +1426,17 @@ void DrawViewShell::GetMenuState( SfxIte
     					bFoundMetafile = true;
 						break;
 					case OBJ_GRAF :
+                    {
 						bSingleGraphicSelected = nMarkCount == 1;
-						switch ( ((SdrGrafObj*)pObj)->GetGraphicType() )
+                        const SdrGrafObj* pSdrGrafObj = static_cast< const SdrGrafObj* >(pObj);
+						switch(pSdrGrafObj->GetGraphicType())
 						{
 							case GRAPHIC_BITMAP :
 								bFoundBitmap = sal_True;
+                                if(pSdrGrafObj->isEmbeddedSvg())
+                                {
+                                    bFoundMetafile = true;
+                                }
 								break;
 							case GRAPHIC_GDIMETAFILE :
 								bFoundMetafile = sal_True;
@@ -1442,6 +1448,7 @@ void DrawViewShell::GetMenuState( SfxIte
 						// #i25616# bFoundObjNoLine = sal_True;
 						// #i25616# bFoundObjNoArea = sal_True;
 						break;
+                    }
 					case OBJ_TABLE:
 						bFoundTable = true;
 						break;

Modified: incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsc.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsc.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsc.cxx Fri Dec 16 16:59:36 2011
@@ -363,10 +363,23 @@ void DrawViewShell::FuTemp03(SfxRequest&
 				    SdrObject*   pObj=pM->GetMarkedSdrObj();
 				    SdrGrafObj*  pGraf=PTR_CAST(SdrGrafObj,pObj);
 					SdrOle2Obj*  pOle2=PTR_CAST(SdrOle2Obj,pObj);
-			        if (pGraf!=NULL && pGraf->HasGDIMetaFile())
-						nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount();
-                    if(pOle2!=NULL && pOle2->GetGraphic())
+
+                    if(pGraf)
+                    {
+                        if(pGraf->HasGDIMetaFile())
+                        {
+                            nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount();
+                        }
+                        else if(pGraf->isEmbeddedSvg())
+                        {
+                            nCount += pGraf->getMetafileFromEmbeddedSvg().GetActionCount();
+                        }
+                    }
+                    
+                    if(pOle2 && pOle2->GetGraphic())
+                    {
                         nCount += pOle2->GetGraphic()->GetGDIMetaFile().GetActionCount();
+                    }
 				}
 
 				// anhand der erm. Summe entscheiden ob mit

Modified: incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsj.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsj.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsj.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/drviewsj.cxx Fri Dec 16 16:59:36 2011
@@ -127,22 +127,22 @@ void DrawViewShell::GetMenuStateSel( Sfx
 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) )
 		{
 			const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+            const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
+            const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
 			sal_uInt32 nInv = pObj->GetObjInventor();
 			sal_uInt16 nId = pObj->GetObjIdentifier();
 			SdrObjTransformInfoRec aInfoRec;
 			pObj->TakeObjInfo( aInfoRec );
 
-
 			// #91929#; don't show original size entry if not possible
-            if ( pObj->ISA( SdrOle2Obj ) )
+            if(pSdrOle2Obj)
 			{
-				SdrOle2Obj* pOleObj = PTR_CAST(SdrOle2Obj, pObj);
-                if (pOleObj->GetObjRef().is() &&
-                    ((pOleObj->GetObjRef()->getStatus( pOleObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
+                if (pSdrOle2Obj->GetObjRef().is() &&
+                    ((pSdrOle2Obj->GetObjRef()->getStatus( pSdrOle2Obj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
 					rSet.DisableItem(SID_ORIGINAL_SIZE);
             }
 
-			if ( !( pObj->ISA( SdrGrafObj ) ) )
+			if(!pSdrGrafObj)
 			{
 				rSet.DisableItem(SID_SAVEGRAPHIC);
 			}
@@ -167,9 +167,10 @@ void DrawViewShell::GetMenuStateSel( Sfx
 				rSet.DisableItem( SID_NAME_GROUP );
 			}
 */
-			if (!pObj->ISA(SdrGrafObj) ||
-				((SdrGrafObj*) pObj)->GetGraphicType() != GRAPHIC_BITMAP ||
-				((SdrGrafObj*) pObj)->IsLinkedGraphic())
+			if(!pSdrGrafObj ||
+				pSdrGrafObj->GetGraphicType() != GRAPHIC_BITMAP ||
+				pSdrGrafObj->IsLinkedGraphic() ||
+                pSdrGrafObj->isEmbeddedSvg())
 			{
 				rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
 				rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);

Modified: incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/sdview.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/sdview.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/sdview.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/sd/source/ui/view/sdview.cxx Fri Dec 16 16:59:36 2011
@@ -1073,10 +1073,15 @@ sal_Bool View::IsVectorizeAllowed() cons
 
 	if( rMarkList.GetMarkCount() == 1 )
 	{
-		const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+		const SdrGrafObj* pObj = dynamic_cast< const SdrGrafObj* >(rMarkList.GetMark( 0 )->GetMarkedSdrObj());
 
-		if( pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
-			bRet = sal_True;
+        if(pObj)
+        {
+            if(GRAPHIC_BITMAP == pObj->GetGraphicType() && !pObj->isEmbeddedSvg())
+            {
+                bRet = sal_True;
+            }
+        }
 	}
 
 	return bRet;

Modified: incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdograf.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdograf.hxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdograf.hxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdograf.hxx Fri Dec 16 16:59:36 2011
@@ -199,7 +199,10 @@ public:
 	virtual void			SetPage(SdrPage* pNewPage);
 	virtual void			SetModel(SdrModel* pNewModel);
 
-	virtual SdrObject*		DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
+    bool isEmbeddedSvg() const;
+    GDIMetaFile getMetafileFromEmbeddedSvg() const;
+
+    virtual SdrObject*		DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
 
 	virtual void			AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
 

Modified: incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdxcgv.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdxcgv.hxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdxcgv.hxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svx/inc/svx/svdxcgv.hxx Fri Dec 16 16:59:36 2011
@@ -75,7 +75,7 @@ public:
 
 	// Alle markierten Objekte auf eine Bitmap malen. Diese hat die Farbtiefe
 	// und Aufloesung des Bildschirms.
-	virtual Bitmap      GetMarkedObjBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const;
+	BitmapEx GetMarkedObjBitmap(bool bNoVDevIfOneBmpMarked = false) const;
 
 	// Alle markierten Objekte in ein neues Model kopieren. Dieses neue Model
 	// hat dann genau eine Page. Das Flag PageNotValid an diesem Model ist
@@ -90,7 +90,7 @@ public:
 	virtual SdrModel*   GetMarkedObjModel() const;
 
 	GDIMetaFile     GetAllMarkedMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const { return GetMarkedObjMetaFile(bNoVDevIfOneMtfMarked); }
-	Bitmap          GetAllMarkedBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const { return GetMarkedObjBitmap(bNoVDevIfOneBmpMarked); }
+	Bitmap          GetAllMarkedBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const { return GetMarkedObjBitmap(bNoVDevIfOneBmpMarked).GetBitmap(); }
 	Graphic         GetAllMarkedGraphic() const;
 	SdrModel*       GetAllMarkedModel() const { return GetMarkedObjModel(); }
 

Modified: incubator/ooo/branches/alg/svgreplacement/main/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx Fri Dec 16 16:59:36 2011
@@ -94,45 +94,14 @@ namespace drawinglayer
 			// add graphic content
 			if(255L != getGraphicAttr().GetTransparency())
 			{
-                const SvgDataPtr& rSvgDataPtr = getGraphicObject().GetGraphic().getSvgData();
-
-                if(rSvgDataPtr.get())
-                {
-                    // Svg fill, use already decomposed svg directly
-                    const basegfx::B2DRange& rRange(rSvgDataPtr->getRange());
-
-                    if(basegfx::fTools::more(rRange.getWidth(), 0.0) && basegfx::fTools::more(rRange.getHeight(), 0.0))
-                    {
-                        basegfx::B2DHomMatrix aEmbeddingTransform(
-                            basegfx::tools::createTranslateB2DHomMatrix(
-                                -rRange.getMinX(),
-                                -rRange.getMinY()));
-                                    
-                        aEmbeddingTransform.scale(
-                            1.0 / rRange.getWidth(),
-                            1.0 / rRange.getHeight());
-
-                        aEmbeddingTransform = getTransform() * aEmbeddingTransform;
-                                    
-                        const Primitive2DReference xPrimitive(
-                            new TransformPrimitive2D(
-                                aEmbeddingTransform,
-                                rSvgDataPtr->getPrimitive2DSequence()));
-
-                        appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xPrimitive);
-                    }
-                }
-                else
-                {
-                    // standard graphic fill
-				    const Primitive2DReference xGraphicContentPrimitive(
-                        new GraphicPrimitive2D(
-                            getTransform(), 
-                            getGraphicObject(), 
-                            getGraphicAttr()));
+                // standard graphic fill
+                const Primitive2DReference xGraphicContentPrimitive(
+                    new GraphicPrimitive2D(
+                        getTransform(), 
+                        getGraphicObject(), 
+                        getGraphicAttr()));
 
-                    appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive);
-                }
+                appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive);
 			}
 
 			// add text

Modified: incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv.cxx Fri Dec 16 16:59:36 2011
@@ -636,19 +636,20 @@ void SdrEditView::CheckPossibilities()
 				if (!bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) bOrthoDesiredOnMarked=sal_True;
 				// ImportMtf checken
 
-                if (!bImportMtfPossible) {
-                    sal_Bool bGraf=HAS_BASE(SdrGrafObj,pObj);
-                    sal_Bool bOle2=HAS_BASE(SdrOle2Obj,pObj);
-
-					if( bGraf &&
-                        ((SdrGrafObj*)pObj)->HasGDIMetaFile() &&
-                        !((SdrGrafObj*)pObj)->IsEPS())
+                if (!bImportMtfPossible) 
+                {
+                    const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
+                    const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
+
+                    if(pSdrGrafObj && ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) || pSdrGrafObj->isEmbeddedSvg()))
                     {
-						bImportMtfPossible = sal_True;
+                        bImportMtfPossible = sal_True;
                     }
 
-					if (bOle2)
-                        bImportMtfPossible=((SdrOle2Obj*)pObj)->GetObjRef().is();
+                    if(pSdrOle2Obj)
+                    {
+                        bImportMtfPossible = pSdrOle2Obj->GetObjRef().is();
+                    }
                 }
 			}
 

Modified: incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv2.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv2.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdedtv2.cxx Fri Dec 16 16:59:36 2011
@@ -2073,18 +2073,31 @@ void SdrEditView::DoImportMarkedMtf(SvdP
 		sal_uIntPtr        nInsAnz=0;
         Rectangle aLogicRect;
 
-		if (pGraf!=NULL && pGraf->HasGDIMetaFile())
-		{
-			ImpSdrGDIMetaFileImport aFilter(*pMod);
-			
-            aLogicRect = pGraf->GetLogicRect();
-            aFilter.SetScaleRect(aLogicRect);
-			aFilter.SetLayer(pObj->GetLayer());
-			
-            nInsAnz=aFilter.DoImport(pGraf->GetTransformedGraphic(
-                SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile(),
-                *pOL,nInsPos,pProgrInfo);
-		}
+		if(pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedSvg()))
+        {
+            GDIMetaFile aMetaFile;
+
+            if(pGraf->HasGDIMetaFile())
+            {
+                aMetaFile = pGraf->GetTransformedGraphic(
+                    SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile();
+            }
+            else if(pGraf->isEmbeddedSvg())
+            {
+                aMetaFile = pGraf->getMetafileFromEmbeddedSvg();
+            }
+
+            if(aMetaFile.GetActionCount())
+            {
+                ImpSdrGDIMetaFileImport aFilter(*pMod);
+
+                aLogicRect = pGraf->GetLogicRect();
+                aFilter.SetScaleRect(aLogicRect);
+                aFilter.SetLayer(pObj->GetLayer());
+
+                nInsAnz = aFilter.DoImport(aMetaFile, *pOL, nInsPos, pProgrInfo);
+            }
+        }
         if ( pOle2!=NULL && pOle2->GetGraphic() )
 		{
             //const GDIMetaFile* pMtf=pOle2->GetGDIMetaFile();

Modified: incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdograf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdograf.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdograf.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdograf.cxx Fri Dec 16 16:59:36 2011
@@ -68,8 +68,6 @@
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <osl/thread.hxx>
 #include <vos/mutex.hxx>
-#include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx>
-#include <basegfx/matrix/b2dhommatrixtools.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::io;
@@ -1093,57 +1091,50 @@ 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;
 
-    if(GRAPHIC_BITMAP == aGraphicType)
+    if(isEmbeddedSvg())
     {
-        const Graphic& rGraphic = GetGraphic();
-
-        if(rGraphic.getSvgData().get())
-        {
-            // 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
-            VirtualDevice aOut;
-            Size aDummySize(2, 2);
-
-            aOut.SetOutputSizePixel(aDummySize);
-            aOut.EnableOutput(false);
-            aMtf.Clear();
-            aMtf.Record(&aOut);
-
-            // map to (0,0,objectsize)
-            const basegfx::B2DRange& rRange = rGraphic.getSvgData()->getRange();
-            basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createTranslateB2DHomMatrix(-rRange.getMinX(), -rRange.getMinY()));
-
-            aObjectMatrix.scale(
-                aRect.getWidth() / (basegfx::fTools::equalZero(rRange.getWidth()) ? 1.0 : rRange.getWidth()),
-                aRect.getHeight() / (basegfx::fTools::equalZero(rRange.getHeight()) ? 1.0 : rRange.getHeight()));
-
-            const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
-                aObjectMatrix,
-                basegfx::B2DHomMatrix(),
-                basegfx::B2DRange(),
-                0,
-                0.0,
-                com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >());
-            drawinglayer::processor2d::VclMetafileProcessor2D aProcessor(aViewInformation2D, aOut);
-
-            aProcessor.process(rGraphic.getSvgData()->getPrimitive2DSequence());
-            
-            aMtf.Stop();
-            aMtf.WindStart();
-            aMtf.SetPrefMapMode(rGraphic.GetPrefMapMode());
-            aMtf.SetPrefSize(rGraphic.GetPrefSize());
-
-            aGraphicType = GRAPHIC_GDIMETAFILE;
-        }
+        // 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)
     {

Modified: incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdxcgv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdxcgv.cxx?rev=1215221&r1=1215220&r2=1215221&view=diff
==============================================================================
--- incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdxcgv.cxx (original)
+++ incubator/ooo/branches/alg/svgreplacement/main/svx/source/svdraw/svdxcgv.cxx Fri Dec 16 16:59:36 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)
         {