Author: alg
Date: Fri May  3 12:22:53 2013
New Revision: 1478751

URL: http://svn.apache.org/r1478751
Log:
i122215 Avoid double paste, allow paste of WMF/EMF as bitmap

Modified:
    openoffice/trunk/main/sd/source/ui/view/sdview3.cxx

Modified: openoffice/trunk/main/sd/source/ui/view/sdview3.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/sdview3.cxx?rev=1478751&r1=1478750&r2=1478751&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/sdview3.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/sdview3.cxx Fri May  3 12:22:53 2013
@@ -1204,6 +1204,7 @@ sal_Bool View::InsertData( const Transfe
                {
                        // if no object was inserted, insert a picture
                        InsertMetaFile( aDataHelper, rPos, pImageMap, true );
+            bReturn = true;
                }
        }
        
@@ -1271,9 +1272,31 @@ sal_Bool View::InsertData( const Transfe
        
     if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(FORMAT_BITMAP))
        {
-               BitmapEx aBmpEx;
+        BitmapEx aBmpEx;
 
-               if( aDataHelper.GetBitmapEx( FORMAT_BITMAP, aBmpEx ) )
+        // get basic Bitmap data
+        aDataHelper.GetBitmapEx(FORMAT_BITMAP, aBmpEx);
+
+        if(aBmpEx.IsEmpty())
+        {
+            // if this did not work, try to get graphic formats and convert 
these to bitmap
+            Graphic aGraphic;
+
+            if(aDataHelper.GetGraphic(FORMAT_GDIMETAFILE, aGraphic))
+            {
+                aBmpEx = aGraphic.GetBitmapEx();
+            }
+            else if(aDataHelper.GetGraphic(SOT_FORMATSTR_ID_SVXB, aGraphic))
+            {
+                aBmpEx = aGraphic.GetBitmapEx();
+            }
+            else if(aDataHelper.GetGraphic(FORMAT_BITMAP, aGraphic))
+            {
+                aBmpEx = aGraphic.GetBitmapEx();
+            }
+        }
+
+        if(!aBmpEx.IsEmpty())
                {
                        Point aInsertPos( rPos );
 
@@ -1300,7 +1323,7 @@ sal_Bool View::InsertData( const Transfe
                        InsertGraphic( aBmpEx, mnAction, aInsertPos, NULL, 
pImageMap );
                        bReturn = true;
                }
-       }
+    }
 
     if(!bReturn && pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) )
        {


Reply via email to