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 2013/01/04 23:58:27 UTC

svn commit: r1429165 [2/3] - in /openoffice/branches/alg/clibboard/main: automation/source/server/ avmedia/source/win/ basic/source/runtime/ canvas/source/vcl/ chart2/source/controller/main/ drawinglayer/source/processor2d/ drawinglayer/source/tools/ d...

Modified: openoffice/branches/alg/clibboard/main/svtools/source/misc/transfer.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/svtools/source/misc/transfer.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/svtools/source/misc/transfer.cxx (original)
+++ openoffice/branches/alg/clibboard/main/svtools/source/misc/transfer.cxx Fri Jan  4 22:58:25 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svtools.hxx"
 #ifdef WNT
@@ -68,6 +66,9 @@
 #include <svtools/imap.hxx>
 #include <svtools/transfer.hxx>
 #include <cstdio>
+#include <vcl/dibtools.hxx>
+#include <vcl/pngread.hxx>
+#include <vcl/pngwrite.hxx>
 
 // --------------
 // - Namespaces -
@@ -370,9 +371,10 @@ Any SAL_CALL TransferableHelper::getTran
 			    GetData( aSubstFlavor );
                 bDone = maAny.hasValue();
             }
-            else if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_BMP, aSubstFlavor ) &&
-                     TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) &&
-                     SotExchange::GetFormatDataFlavor( FORMAT_BITMAP, aSubstFlavor ) )
+            else if((SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_BMP, aSubstFlavor ) 
+                    || (SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aSubstFlavor))) 
+                && TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor )
+                && SotExchange::GetFormatDataFlavor(FORMAT_BITMAP, aSubstFlavor))
             {
 			    GetData( aSubstFlavor );
                 bDone = sal_True;
@@ -698,6 +700,7 @@ void TransferableHelper::AddFormat( cons
 		if( FORMAT_BITMAP == aFlavorEx.mnSotId )
 		{
 			AddFormat( SOT_FORMATSTR_ID_BMP );
+			AddFormat( SOT_FORMATSTR_ID_PNG );
 		}
 		else if( FORMAT_GDIMETAFILE == aFlavorEx.mnSotId )
 		{
@@ -798,14 +801,38 @@ sal_Bool TransferableHelper::SetString( 
 
 // -----------------------------------------------------------------------------
 
-sal_Bool TransferableHelper::SetBitmap( const Bitmap& rBitmap, const DataFlavor& )
+sal_Bool TransferableHelper::SetBitmapEx( const BitmapEx& rBitmapEx, const DataFlavor& rFlavor )
 {
-	if( !rBitmap.IsEmpty() )
+	if( !rBitmapEx.IsEmpty() )
 	{
-		SvMemoryStream aMemStm( 65535, 65535 );
+        SvMemoryStream aMemStm( 65535, 65535 );
 
-		aMemStm << rBitmap;
-		maAny <<= Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
+        if(rFlavor.MimeType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("image/png")))
+        {
+            // write a PNG
+            ::vcl::PNGWriter aPNGWriter(rBitmapEx);
+
+            aPNGWriter.Write(aMemStm);
+        }
+        else
+        {
+            const Bitmap aBitmap(rBitmapEx.GetBitmap());
+
+            if(rBitmapEx.IsTransparent())
+            {
+                const Bitmap aMask(rBitmapEx.GetAlpha().GetBitmap());
+
+                // explicitely use Bitmap::Write with bCompressed = sal_False and bFileHeader = sal_True
+                WriteDIBV5(aBitmap, aMask, aMemStm);
+            }
+            else
+            {
+                // explicitely use Bitmap::Write with bCompressed = sal_False and bFileHeader = sal_True
+                WriteDIB(aBitmap, aMemStm, false, true);
+            }
+        }
+
+        maAny <<= Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
 	}
 
 	return( maAny.hasValue() );
@@ -1441,7 +1468,7 @@ void TransferableDataHelper::FillDataFla
 		    rDataFlavorExVector.push_back( aFlavorEx );
 
             // add additional formats for special mime types
-            if( SOT_FORMATSTR_ID_BMP == aFlavorEx.mnSotId )
+            if(SOT_FORMATSTR_ID_BMP == aFlavorEx.mnSotId || SOT_FORMATSTR_ID_PNG == aFlavorEx.mnSotId)
 		    {
 			    if( SotExchange::GetFormatDataFlavor( SOT_FORMAT_BITMAP, aFlavorEx ) )
 			    {
@@ -1755,57 +1782,100 @@ sal_Bool TransferableDataHelper::GetStri
 
 // -----------------------------------------------------------------------------
 
-sal_Bool TransferableDataHelper::GetBitmap( SotFormatStringId nFormat, Bitmap& rBmp )
+sal_Bool TransferableDataHelper::GetBitmapEx( SotFormatStringId nFormat, BitmapEx& rBmpEx )
 {
 	DataFlavor aFlavor;
-	return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetBitmap( aFlavor, rBmp ) );
+
+    if(FORMAT_BITMAP == nFormat)
+    {
+        // try to get PNG first
+        if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aFlavor))
+        {
+            if(GetBitmapEx(aFlavor, rBmpEx))
+            {
+                return true;
+            }
+        }
+    }
+
+    return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetBitmapEx( aFlavor, rBmpEx ) );
 }
 
 // -----------------------------------------------------------------------------
 
-sal_Bool TransferableDataHelper::GetBitmap( const DataFlavor& rFlavor, Bitmap& rBmp )
+sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& rBmpEx )
 {
-	SotStorageStreamRef xStm;
-	DataFlavor			aSubstFlavor;
-	sal_Bool			bRet = GetSotStorageStream( rFlavor, xStm );
+    SotStorageStreamRef xStm;
+    DataFlavor aSubstFlavor;
+    bool bRet(GetSotStorageStream(rFlavor, xStm));
 
-	if( bRet )
-	{
-		*xStm >> rBmp;
-		bRet = ( xStm->GetError() == ERRCODE_NONE );
+    if(!bRet && HasFormat(SOT_FORMATSTR_ID_PNG) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aSubstFlavor))
+    {
+        // when no direct success, try if PNG is available
+        bRet = GetSotStorageStream(aSubstFlavor, xStm);
+    }
 
-		/* SJ: #110748# At the moment we are having problems with DDB inserted as DIB. The
-		   problem is, that some graphics are inserted much too big because the nXPelsPerMeter
-		   and nYPelsPerMeter of the bitmap fileheader isn't including the correct value.
-		   Due to this reason the following code assumes that bitmaps with a logical size
-		   greater than 50 cm aren't having the correct mapmode set.
-
-		   The following code should be removed if DDBs and DIBs are supported via clipboard
-		   properly.
-		*/
-		if ( bRet )
-		{
-			MapMode aMapMode = rBmp.GetPrefMapMode();
-			if ( aMapMode.GetMapUnit() != MAP_PIXEL )
-			{
-				Size aSize = OutputDevice::LogicToLogic( rBmp.GetPrefSize(), aMapMode, MAP_100TH_MM );
-				if ( ( aSize.Width() > 5000 ) || ( aSize.Height() > 5000 ) )
-					rBmp.SetPrefMapMode( MAP_PIXEL );
-			}
-		}
-	}
+    if(!bRet && HasFormat(SOT_FORMATSTR_ID_BMP) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_BMP, aSubstFlavor))
+    {
+        // when no direct success, try if BMP is available
+        bRet = GetSotStorageStream(aSubstFlavor, xStm);
+    }
 
-	if( !bRet &&
-		HasFormat( SOT_FORMATSTR_ID_BMP ) &&
-		SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_BMP, aSubstFlavor ) &&
-		GetSotStorageStream( aSubstFlavor, xStm ) )
-	{
-	    xStm->ResetError();
-		*xStm >> rBmp;
-		bRet = ( xStm->GetError() == ERRCODE_NONE );
-	}
+    if(bRet)
+    {
+        if(rFlavor.MimeType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("image/png")))
+        {
+            // it's a PNG, import to BitmapEx
+            ::vcl::PNGReader aPNGReader(*xStm);
 
-	return bRet;
+            rBmpEx = aPNGReader.Read();
+        }
+        else
+        {
+            Bitmap aBitmap;
+            Bitmap aMask;
+
+            // explicitely use Bitmap::Read with bFileHeader = sal_True
+            ReadDIBV5(aBitmap, aMask, *xStm);
+
+            if(aMask.IsEmpty())
+            {
+                rBmpEx = aBitmap;
+            }
+            else
+            {
+                rBmpEx = BitmapEx(aBitmap, aMask);
+            }
+        }
+
+        bRet = (ERRCODE_NONE == xStm->GetError());
+
+        /* SJ: #110748# At the moment we are having problems with DDB inserted as DIB. The
+           problem is, that some graphics are inserted much too big because the nXPelsPerMeter
+           and nYPelsPerMeter of the bitmap fileheader isn't including the correct value.
+           Due to this reason the following code assumes that bitmaps with a logical size
+           greater than 50 cm aren't having the correct mapmode set.
+        
+           The following code should be removed if DDBs and DIBs are supported via clipboard
+           properly.
+        */
+        if(bRet)
+        {
+            const MapMode aMapMode(rBmpEx.GetPrefMapMode());
+
+            if(MAP_PIXEL != aMapMode.GetMapUnit())
+            {
+                const Size aSize(OutputDevice::LogicToLogic(rBmpEx.GetPrefSize(), aMapMode, MAP_100TH_MM));
+
+                if((aSize.Width() > 5000) || (aSize.Height() > 5000))
+                {
+                    rBmpEx.SetPrefMapMode(MAP_PIXEL);
+                }
+            }
+        }
+    }
+
+    return bRet;
 }
 
 // -----------------------------------------------------------------------------
@@ -1865,8 +1935,21 @@ sal_Bool TransferableDataHelper::GetGDIM
 
 sal_Bool TransferableDataHelper::GetGraphic( SotFormatStringId nFormat, Graphic& rGraphic )
 {
-	DataFlavor aFlavor;
-	return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetGraphic( aFlavor, rGraphic ) );
+    DataFlavor aFlavor;
+
+    if(FORMAT_BITMAP == nFormat)
+    {
+        // try to get PNG first
+        if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aFlavor))
+        {
+            if(GetGraphic(aFlavor, rGraphic))
+            {
+                return true;
+            }
+        }
+    }
+
+    return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetGraphic( aFlavor, rGraphic ) );
 }
 
 // -----------------------------------------------------------------------------
@@ -1876,13 +1959,21 @@ sal_Bool TransferableDataHelper::GetGrap
 	DataFlavor	aFlavor;
 	sal_Bool	bRet = sal_False;
 
-	if(	SotExchange::GetFormatDataFlavor( SOT_FORMAT_BITMAP, aFlavor ) &&
+    if(SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aFlavor) && TransferableDataHelper::IsEqual(aFlavor, rFlavor))
+	{
+        // try to get PNG first
+		BitmapEx aBmpEx;
+
+		if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) == sal_True )
+			rGraphic = aBmpEx;
+	}
+	else if(SotExchange::GetFormatDataFlavor( SOT_FORMAT_BITMAP, aFlavor ) &&
 		TransferableDataHelper::IsEqual( aFlavor, rFlavor ) )
 	{
-		Bitmap aBmp;
+		BitmapEx aBmpEx;
 
-		if( ( bRet = GetBitmap( aFlavor, aBmp ) ) == sal_True )
-			rGraphic = aBmp;
+		if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) == sal_True )
+			rGraphic = aBmpEx;
 	}
 	else if( SotExchange::GetFormatDataFlavor( SOT_FORMAT_GDIMETAFILE, aFlavor ) &&
 			 TransferableDataHelper::IsEqual( aFlavor, rFlavor ) )

Modified: openoffice/branches/alg/clibboard/main/svx/inc/svx/xoutbmp.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/svx/inc/svx/xoutbmp.hxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/svx/inc/svx/xoutbmp.hxx (original)
+++ openoffice/branches/alg/clibboard/main/svx/inc/svx/xoutbmp.hxx Fri Jan  4 22:58:25 2013
@@ -61,19 +61,11 @@ public:
 
 	static GraphicFilter* pGrfFilter;
 
-	static BitmapEx		CreateQuickDrawBitmapEx( const Graphic& rGraphic, const OutputDevice& rCompDev,
-												 const MapMode& rMapMode, const Size& rLogSize,
-												 const Point& rPoint, const Size& rSize );
 	static Graphic		MirrorGraphic( const Graphic& rGraphic, const sal_uIntPtr nMirrorFlags );
 	static Animation	MirrorAnimation( const Animation& rAnimation, sal_Bool bHMirr, sal_Bool bVMirr );
 	static sal_uInt16		WriteGraphic( const Graphic& rGraphic, String& rFileName,
 									  const String& rFilterName, const sal_uIntPtr nFlags = 0L,
 									  const Size* pMtfSize_100TH_MM = NULL );
-	static void			DrawQuickDrawBitmapEx( OutputDevice* pOutDev, const Point& rPt,
-											   const Size& rSize, const BitmapEx& rBmpEx );
-	static void			DrawTiledBitmapEx( OutputDevice* pOutDev, const Point& rStartPt, const Size& rGrfSize,
-										   const Rectangle& rTileRect, const BitmapEx& rBmpEx );
-
 	static sal_uInt16		ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
 									   GraphicFilter& rFilter, const sal_uInt16 nFormat,
 									   const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL );

Modified: openoffice/branches/alg/clibboard/main/svx/source/gallery2/galmisc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/svx/source/gallery2/galmisc.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/svx/source/gallery2/galmisc.cxx (original)
+++ openoffice/branches/alg/clibboard/main/svx/source/gallery2/galmisc.cxx Fri Jan  4 22:58:25 2013
@@ -606,7 +606,7 @@ sal_Bool GalleryTransferable::GetData( c
 	}
 	else if( ( FORMAT_BITMAP == nFormat ) && mpGraphicObject )
 	{
-		bRet = SetBitmap( mpGraphicObject->GetGraphic().GetBitmap(), rFlavor );
+		bRet = SetBitmapEx( mpGraphicObject->GetGraphic().GetBitmapEx(), rFlavor );
 	}
 
 	return bRet;

Modified: openoffice/branches/alg/clibboard/main/svx/source/gallery2/galobj.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/svx/source/gallery2/galobj.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/svx/source/gallery2/galobj.cxx (original)
+++ openoffice/branches/alg/clibboard/main/svx/source/gallery2/galobj.cxx Fri Jan  4 22:58:25 2013
@@ -29,10 +29,8 @@
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <sfx2/objsh.hxx>
 #include <sfx2/docfac.hxx>
-
 #include <comphelper/classids.hxx>
 #include <unotools/pathoptions.hxx>
-
 #include <tools/rcid.h>
 #include <tools/vcompat.hxx>
 #include <vcl/virdev.hxx>
@@ -45,7 +43,7 @@
 #include "galobj.hxx"
 #include <vcl/salbtype.hxx>		// FRound
 #include <vcl/svapp.hxx>
-
+#include <vcl/dibtools.hxx>
 #include "gallerydrawmodel.hxx"
 
 using namespace ::com::sun::star;
@@ -160,7 +158,7 @@ void SgaObject::WriteData( SvStream& rOu
 		rOut.SetCompressMode( COMPRESSMODE_ZBITMAP );
 		rOut.SetVersion( SOFFICE_FILEFORMAT_50 );
 
-		rOut << aThumbBmp;
+        WriteDIBBitmapEx(aThumbBmp, rOut);
 
 		rOut.SetVersion( nOldVersion );
 		rOut.SetCompressMode( nOldCompressMode );
@@ -184,9 +182,13 @@ void SgaObject::ReadData(SvStream& rIn, 
 	rIn >> nTmp32 >> nTmp16 >> rReadVersion >> nTmp16 >> bIsThumbBmp;
 
 	if( bIsThumbBmp )
-		rIn >> aThumbBmp;
+    {
+        ReadDIBBitmapEx(aThumbBmp, rIn);
+    }
 	else
+    {
 		rIn >> aThumbMtf;
+    }
 
 	rIn >> aTmpStr; aURL = INetURLObject( String( aTmpStr.GetBuffer(), RTL_TEXTENCODING_UTF8 ) );
 }

Modified: openoffice/branches/alg/clibboard/main/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/svx/source/sdr/overlay/overlaymanagerbuffered.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/svx/source/sdr/overlay/overlaymanagerbuffered.cxx (original)
+++ openoffice/branches/alg/clibboard/main/svx/source/sdr/overlay/overlaymanagerbuffered.cxx Fri Jan  4 22:58:25 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 #include <svx/sdr/overlay/overlaymanagerbuffered.hxx>
@@ -33,6 +31,7 @@
 #include <tools/stream.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <vcl/cursor.hxx>
+#include <vcl/dibtools.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -253,7 +252,7 @@ namespace sdr
                 {
                     const Bitmap aBitmap(maBufferDevice.GetBitmap(aTopLeft, aSize));
                     SvFileStream aNew((const String&)String(ByteString( "c:\\test.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC);
-                    aNew << aBitmap;
+                    WriteDIB(aBitmap, aNew, false, true);
                 }
 #endif
             }

Modified: openoffice/branches/alg/clibboard/main/svx/source/xoutdev/_xoutbmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/svx/source/xoutdev/_xoutbmp.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/svx/source/xoutdev/_xoutbmp.cxx (original)
+++ openoffice/branches/alg/clibboard/main/svx/source/xoutdev/_xoutbmp.cxx Fri Jan  4 22:58:25 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
@@ -37,6 +35,7 @@
 #include "svx/xoutbmp.hxx"
 #include <svtools/FilterConfigItem.hxx>
 #include <svtools/filter.hxx>
+#include <vcl/dibtools.hxx>
 
 // -----------
 // - Defines -
@@ -53,186 +52,6 @@
 
 GraphicFilter* XOutBitmap::pGrfFilter = NULL;
 
-// -----------------------------------------------------------------------------
-
-BitmapEx XOutBitmap::CreateQuickDrawBitmapEx( const Graphic& rGraphic, const OutputDevice& rCompDev,
-											  const MapMode& rMapMode, const Size& rLogSize,
-											  const Point& rPoint, const Size& rSize )
-{
-	BitmapEx aRetBmp;
-
-	if( rGraphic.IsAlpha() )
-		aRetBmp = rGraphic.GetBitmapEx();
-	else
-	{
-		VirtualDevice	aVDev( rCompDev );
-		MapMode			aMap( rMapMode );
-
-		aMap.SetOrigin( Point() );
-		aVDev.SetMapMode( aMap );
-
-		Point	aPoint( aVDev.LogicToPixel( rPoint ) );
-		Size	aOldSize( aVDev.LogicToPixel( rSize ) );
-		Size	aAbsSize( aOldSize );
-		Size	aQSizePix( aVDev.LogicToPixel( rLogSize ) );
-
-		aVDev.SetMapMode( MapMode() );
-
-		if( aOldSize.Width() < 0 )
-			aAbsSize.Width() = -aAbsSize.Width();
-
-		if( aOldSize.Height() < 0 )
-			aAbsSize.Height() = -aAbsSize.Height();
-
-		if( aVDev.SetOutputSizePixel( aAbsSize ) )
-		{
-			Point		aNewOrg( -aPoint.X(), -aPoint.Y() );
-			const Point	aNullPoint;
-
-			// horizontale Spiegelung ggf. beruecksichtigen
-			if( aOldSize.Width() < 0 )
-			{
-				aNewOrg.X() -= aOldSize.Width();
-
-				// und jetzt noch einen abziehen
-				aNewOrg.X()--;
-			}
-
-			// vertikale Spiegelung ggf. beruecksichtigen
-			if( rSize.Height() < 0 )
-			{
-				aNewOrg.Y() -= aOldSize.Height();
-
-				// und jetzt noch einen abziehen
-				aNewOrg.Y()--;
-			}
-
-			if( rGraphic.GetType() != GRAPHIC_BITMAP )
-			{
-				rGraphic.Draw( &aVDev, aNewOrg, aQSizePix );
-
-				const Bitmap	aBmp( aVDev.GetBitmap( aNullPoint, aAbsSize ) );
-				Bitmap			aMask;
-
-				Graphic( rGraphic.GetGDIMetaFile().GetMonochromeMtf( COL_BLACK ) ).Draw( &aVDev, aNewOrg, aQSizePix );
-				aMask = aVDev.GetBitmap( aNullPoint, aAbsSize );
-				aRetBmp = BitmapEx( aBmp, aMask );
-			}
-			else
-			{
-				Bitmap	aBmp( rGraphic.GetBitmap() );
-
-// UNX has got problems with 1x1 bitmaps which are transparent (KA 02.11.1998)
-#ifdef UNX
-				const Size	aBmpSize( aBmp.GetSizePixel() );
-				sal_Bool		bFullTrans = sal_False;
-
-				if( aBmpSize.Width() == 1 && aBmpSize.Height() == 1 && rGraphic.IsTransparent() )
-				{
-					Bitmap				aTrans( rGraphic.GetBitmapEx().GetMask() );
-					BitmapReadAccess*	pMAcc = aBmp.AcquireReadAccess();
-
-					if( pMAcc )
-					{
-						if( pMAcc->GetColor( 0, 0 ) == BitmapColor( Color( COL_WHITE ) ) )
-							bFullTrans = sal_True;
-
-						aTrans.ReleaseAccess( pMAcc );
-					}
-				}
-
-				if( !bFullTrans )
-#endif // UNX
-
-				{
-					DitherBitmap( aBmp );
-					aVDev.DrawBitmap( aNewOrg, aQSizePix, aBmp );
-					aBmp = aVDev.GetBitmap( aNullPoint, aAbsSize );
-
-					if( !rGraphic.IsTransparent() )
-						aRetBmp = BitmapEx( aBmp );
-					else
-					{
-						Bitmap	aTrans( rGraphic.GetBitmapEx().GetMask() );
-
-						if( !aTrans )
-							aRetBmp = BitmapEx( aBmp, rGraphic.GetBitmapEx().GetTransparentColor() );
-						else
-						{
-							aVDev.DrawBitmap( aNewOrg, aQSizePix, aTrans );
-							aRetBmp = BitmapEx( aBmp, aVDev.GetBitmap( Point(), aAbsSize ) );
-						}
-					}
-				}
-			}
-		}
-	}
-
-	return aRetBmp;
-}
-
-// ------------------------------------------------------------------------
-
-void XOutBitmap::DrawQuickDrawBitmapEx( OutputDevice* pOutDev, const Point& rPt,
-										const Size& rSize, const BitmapEx& rBmpEx )
-{
-	const Size		aBmpSizePix( rBmpEx.GetSizePixel() );
-	const Size		aSizePix( pOutDev->LogicToPixel( rSize ) );
-
-	if ( ( aSizePix.Width() - aBmpSizePix.Width() ) || ( aSizePix.Height() - aBmpSizePix.Height() ) )
-		rBmpEx.Draw( pOutDev, rPt, rSize );
-	else
-		rBmpEx.Draw( pOutDev, rPt );
-}
-
-// ------------------------------------------------------------------------
-
-void XOutBitmap::DrawTiledBitmapEx( OutputDevice* pOutDev,
-									const Point& rStartPt, const Size& rGrfSize,
-									const Rectangle& rTileRect, const BitmapEx& rBmpEx )
-{
-	Rectangle		aClipRect( pOutDev->LogicToPixel( pOutDev->GetClipRegion().GetBoundRect() ) );
-	Rectangle		aPixRect( pOutDev->LogicToPixel( rTileRect ) );
-	const Size		aPixSize( pOutDev->LogicToPixel( rGrfSize ) );
-	const Point		aPixPoint( pOutDev->LogicToPixel( rStartPt ) );
-	Point  			aOrg;
-	const long		nWidth = aPixSize.Width();
-	const long 		nHeight = aPixSize.Height();
-	long			nXPos = aPixPoint.X() + ( ( aPixRect.Left() - aPixPoint.X() ) / nWidth ) * nWidth;
-	long			nYPos = aPixPoint.Y() + ( ( aPixRect.Top() - aPixPoint.Y() ) / nHeight ) * nHeight;
-	const long		nBottom = aPixRect.Bottom();
-	const long		nRight = aPixRect.Right();
-	const long		nLeft = nXPos;
-	const sal_Bool		bNoSize = ( aPixSize == rBmpEx.GetSizePixel() );
-
-	pOutDev->Push();
-	pOutDev->SetMapMode( MapMode() );
-
-	// ggf. neue ClipRegion berechnen und setzen
-	if ( pOutDev->IsClipRegion() )
-		aPixRect.Intersection( aClipRect );
-
-	pOutDev->SetClipRegion( aPixRect );
-
-	while( nYPos <= nBottom )
-	{
-		while( nXPos <= nRight )
-		{
-			if ( bNoSize )
-				rBmpEx.Draw( pOutDev, Point( nXPos, nYPos ) );
-			else
-				rBmpEx.Draw( pOutDev, Point( nXPos, nYPos ), aPixSize );
-
-			nXPos += nWidth;
-		}
-
-		nXPos = nLeft;
-		nYPos += nHeight;
-	}
-
-	pOutDev->Pop();
-}
-
 // ------------------------------------------------------------------------
 
 Animation XOutBitmap::MirrorAnimation( const Animation& rAnimation, sal_Bool bHMirr, sal_Bool bVMirr )
@@ -577,8 +396,8 @@ Bitmap XOutBitmap::DetectEdges( const Bi
 				const long			nHeight = aSize.Height();
 				const long			nHeight2 = nHeight - 2L;
 				const long			lThres2 = (long) cThreshold * cThreshold;
-				const sal_uInt8 nWhitePalIdx = pWriteAcc->GetBestPaletteIndex( Color( COL_WHITE ) );
-				const sal_uInt8 nBlackPalIdx = pWriteAcc->GetBestPaletteIndex( Color( COL_BLACK ) );
+				const sal_uInt8 nWhitePalIdx(static_cast< sal_uInt8 >(pWriteAcc->GetBestPaletteIndex(Color(COL_WHITE))));
+				const sal_uInt8 nBlackPalIdx(static_cast< sal_uInt8 >(pWriteAcc->GetBestPaletteIndex(Color(COL_BLACK))));
 				long				nSum1;
 				long				nSum2;
 				long				lGray;

Modified: openoffice/branches/alg/clibboard/main/svx/source/xoutdev/xattrbmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/svx/source/xoutdev/xattrbmp.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/svx/source/xoutdev/xattrbmp.cxx (original)
+++ openoffice/branches/alg/clibboard/main/svx/source/xoutdev/xattrbmp.cxx Fri Jan  4 22:58:25 2013
@@ -42,6 +42,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <vcl/salbtype.hxx>
 #include <vcl/bmpacc.hxx>
+#include <vcl/dibtools.hxx>
 
 using namespace ::com::sun::star;
 
@@ -154,7 +155,7 @@ XFillBitmapItem::XFillBitmapItem(SvStrea
 		    // Behandlung der alten Bitmaps
 		    Bitmap aBmp;
 
-		    rIn >> aBmp;
+            ReadDIB(aBmp, rIn, true);
             maGraphicObject = Graphic(aBmp);
 	    }
 	    else if(1 == nVer)
@@ -174,7 +175,7 @@ XFillBitmapItem::XFillBitmapItem(SvStrea
 		    {
 			    Bitmap aBmp;
 
-                rIn >> aBmp;
+                ReadDIB(aBmp, rIn, true);
                 maGraphicObject = Graphic(aBmp);
 		    }
 		    else if(XBITMAP_8X8 == iTmp)
@@ -201,7 +202,7 @@ XFillBitmapItem::XFillBitmapItem(SvStrea
         {
 		    BitmapEx aBmpEx;
 
-		    rIn >> aBmpEx;
+            ReadDIBBitmapEx(aBmpEx, rIn);
             maGraphicObject = Graphic(aBmpEx);
         }
     }
@@ -253,7 +254,7 @@ SvStream& XFillBitmapItem::Store( SvStre
 
 	if(!IsIndex())
 	{
-        rOut << maGraphicObject.GetGraphic().GetBitmapEx();
+        WriteDIBBitmapEx(maGraphicObject.GetGraphic().GetBitmapEx(), rOut);
 	}
 
 	return rOut;

Modified: openoffice/branches/alg/clibboard/main/sw/source/core/view/viewsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/sw/source/core/view/viewsh.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/sw/source/core/view/viewsh.cxx (original)
+++ openoffice/branches/alg/clibboard/main/sw/source/core/view/viewsh.cxx Fri Jan  4 22:58:25 2013
@@ -19,25 +19,18 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #define _SVX_PARAITEM_HXX
 #define _SVX_TEXTITEM_HXX
 
 #include <com/sun/star/accessibility/XAccessible.hpp>
-
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/progress.hxx>
 #include <svx/srchdlg.hxx>
 #include <svx/svdobj.hxx>
 #include <sfx2/viewsh.hxx>
-#ifndef _SHL_HXX
-//#include <tools/shl.hxx>
-#endif
 #include <swwait.hxx>
 #include <swmodule.hxx>
 #include <fesh.hxx>
@@ -59,9 +52,7 @@
 #include <fntcache.hxx>
 #include <ptqueue.hxx>
 #include <tabfrm.hxx>
-#ifndef _DOCSH_HXX
 #include <docsh.hxx>
-#endif
 #include <pagedesc.hxx>
 #include <ndole.hxx>
 #include <ndindex.hxx>
@@ -69,27 +60,17 @@
 #include <svtools/colorcfg.hxx>
 #include <svtools/accessibilityoptions.hxx>
 #include <accessibilityoptions.hxx>
-#ifndef _STATSTR_HRC
 #include <statstr.hrc>
-#endif
-#ifndef _COMCORE_HRC
 #include <comcore.hrc>
-#endif
-// OD 14.01.2003 #103492#
 #include <pagepreviewlayout.hxx>
-// --> OD 2004-05-24 #i28701#
 #include <sortedobjs.hxx>
 #include <anchoredobject.hxx>
-// <--
-
 #include "../../ui/inc/view.hxx"
 #include <PostItMgr.hxx>
 #include <vcl/virdev.hxx>
-
 #include <vcl/svapp.hxx>
-
-// #i74769#
 #include <svx/sdrpaintwindow.hxx>
+#include <vcl/dibtools.hxx>
 
 sal_Bool ViewShell::bLstAct = sal_False;
 ShellResource *ViewShell::pShellRes = 0;
@@ -1447,7 +1428,7 @@ sal_Bool ViewShell::SmoothScroll( long l
 					const Bitmap aBitmap(pVout->GetBitmap(Point(), pVout->GetOutputSizePixel()));
                     const String aTmpString(ByteString( "c:\\test.bmp" ), RTL_TEXTENCODING_UTF8);
                     SvFileStream aNew(aTmpString, STREAM_WRITE|STREAM_TRUNC);
-					aNew << aBitmap;
+                    WriteDIB(aBitmap, aNew, false, true);
 					pVout->EnableMapMode(bMapModeWasEnabledVDev);
 				}
 			}

Modified: openoffice/branches/alg/clibboard/main/sw/source/filter/ww1/w1filter.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/sw/source/filter/ww1/w1filter.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/sw/source/filter/ww1/w1filter.cxx (original)
+++ openoffice/branches/alg/clibboard/main/sw/source/filter/ww1/w1filter.cxx Fri Jan  4 22:58:25 2013
@@ -19,28 +19,21 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 #include <hintids.hxx>
-
 #include <tools/solar.h>
 #include <comphelper/string.hxx>
 #include <editeng/paperinf.hxx>
 #include <svtools/filter.hxx>
-#ifndef _GRAPH_HXX //autogen
 #include <vcl/graph.hxx>
-#endif
 #include <editeng/fontitem.hxx>
 #include <editeng/lrspitem.hxx>
 #include <editeng/ulspitem.hxx>
 #include <editeng/wghtitem.hxx>
 #include <editeng/postitem.hxx>
 #include <editeng/crsditem.hxx>
-#ifndef _SVX_CNTRITEM_HXX //autogen
 #include <editeng/cntritem.hxx>
-#endif
 #include <editeng/cmapitem.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <editeng/udlnitem.hxx>
@@ -48,9 +41,7 @@
 #include <editeng/colritem.hxx>
 #include <editeng/kernitem.hxx>
 #include <editeng/escpitem.hxx>
-#ifndef _SVX_TSTPITEM_HXX //autogen
 #include <editeng/tstpitem.hxx>
-#endif
 #include <svl/urihelper.hxx>
 #include <fmtfsize.hxx>
 #include <doc.hxx>
@@ -65,19 +56,14 @@
 #include <section.hxx>			// class SwSection
 #include <fltini.hxx>
 #include <w1par.hxx>
-
 #include <docsh.hxx>
 #include <swerror.h>
 #include <mdiexp.hxx>
-#ifndef _STATSTR_HRC
 #include <statstr.hrc>
-#endif
-#if OSL_DEBUG_LEVEL > 1
 #include <stdio.h>
-#endif
-
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
+#include <vcl/dibtools.hxx>
 
 #define MAX_FIELDLEN 64000
 
@@ -1970,7 +1956,7 @@ void Ww1Picture::Out(Ww1Shell& rOut, Ww1
 		SvMemoryStream aOut(nSiz, 8192);
 		WriteBmp(aOut);
 		Bitmap aBmp;
-		aOut >> aBmp;
+        ReadDIB(aBmp, aOut, true);
 		pGraphic = new Graphic(aBmp);
 	}
 	default:

Modified: openoffice/branches/alg/clibboard/main/sw/source/filter/ww8/ww8par.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/sw/source/filter/ww8/ww8par.hxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/sw/source/filter/ww8/ww8par.hxx (original)
+++ openoffice/branches/alg/clibboard/main/sw/source/filter/ww8/ww8par.hxx Fri Jan  4 22:58:25 2013
@@ -192,7 +192,7 @@ public:
     SwNumRule* CreateNextRule(bool bSimple);
     ~WW8ListManager();
 	SwNumRule* GetNumRule(sal_uInt16 i);	
-	sal_uInt16 GetWW8LSTInfoNum() const{return maLSTInfos.size();}
+	sal_uInt16 GetWW8LSTInfoNum() const{return static_cast< sal_uInt16 >(maLSTInfos.size());}
 private:
     wwSprmParser maSprmParser;
     SwWW8ImplReader& rReader;

Modified: openoffice/branches/alg/clibboard/main/sw/source/ui/dochdl/swdtflvr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/sw/source/ui/dochdl/swdtflvr.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/sw/source/ui/dochdl/swdtflvr.cxx (original)
+++ openoffice/branches/alg/clibboard/main/sw/source/ui/dochdl/swdtflvr.cxx Fri Jan  4 22:58:25 2013
@@ -540,10 +540,11 @@ sal_Bool SwTransferable::GetData( const 
 				bOK = SetGDIMetaFile( pClpGraphic->GetGDIMetaFile(), rFlavor );
 			break;
 		case SOT_FORMAT_BITMAP:
+        case SOT_FORMATSTR_ID_PNG:
             // #126398#  Neither pClpBitmap nor pClpGraphic are necessarily set
             if( (eBufferType & TRNSFR_GRAPHIC) && (pClpBitmap != 0 || pClpGraphic != 0))
-				bOK = SetBitmap( (pClpBitmap ? pClpBitmap
-											 : pClpGraphic)->GetBitmap(),
+				bOK = SetBitmapEx( (pClpBitmap ? pClpBitmap
+											 : pClpGraphic)->GetBitmapEx(),
 								 rFlavor );
 			break;
 
@@ -794,6 +795,7 @@ int SwTransferable::PrepareForCopy( sal_
         // <--
 		{
 			AddFormat( FORMAT_GDIMETAFILE );
+            AddFormat( SOT_FORMATSTR_ID_PNG );
 			AddFormat( FORMAT_BITMAP );
 		}
 		eBufferType = TRNSFR_GRAPHIC;
@@ -900,6 +902,7 @@ int SwTransferable::PrepareForCopy( sal_
 			if ( nSelection & nsSelectionType::SEL_DRW )
 			{
 				AddFormat( FORMAT_GDIMETAFILE );
+                AddFormat( SOT_FORMATSTR_ID_PNG );
 				AddFormat( FORMAT_BITMAP );
 			}
 			eBufferType = (TransferBufferType)( TRNSFR_GRAPHIC | eBufferType );
@@ -2990,6 +2993,7 @@ void SwTransferable::SetDataForDragAndDr
         // <--
 		{
 			AddFormat( FORMAT_GDIMETAFILE );
+            AddFormat( SOT_FORMATSTR_ID_PNG );
 			AddFormat( FORMAT_BITMAP );
 		}
 		eBufferType = TRNSFR_GRAPHIC;
@@ -3039,6 +3043,7 @@ void SwTransferable::SetDataForDragAndDr
 			if ( nSelection & nsSelectionType::SEL_DRW )
 			{
 				AddFormat( FORMAT_GDIMETAFILE );
+                AddFormat( SOT_FORMATSTR_ID_PNG );
 				AddFormat( FORMAT_BITMAP );
 			}
 			eBufferType = (TransferBufferType)( TRNSFR_GRAPHIC | eBufferType );

Modified: openoffice/branches/alg/clibboard/main/toolkit/source/awt/vclxbitmap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/toolkit/source/awt/vclxbitmap.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/toolkit/source/awt/vclxbitmap.cxx (original)
+++ openoffice/branches/alg/clibboard/main/toolkit/source/awt/vclxbitmap.cxx Fri Jan  4 22:58:25 2013
@@ -19,18 +19,16 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_toolkit.hxx"
 
-
 #include <toolkit/awt/vclxbitmap.hxx>
 #include <toolkit/helper/macros.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <tools/stream.hxx>
 #include <rtl/memory.h>
 #include <rtl/uuid.h>
+#include <vcl/dibtools.hxx>
 
 //	----------------------------------------------------
 //	class VCLXBitmap
@@ -71,7 +69,7 @@ IMPL_XTYPEPROVIDER_END
 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
 
 	SvMemoryStream aMem;
-	aMem << maBitmap.GetBitmap();
+    WriteDIB(maBitmap.GetBitmap(), aMem, false, true);
 	return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
 }
 
@@ -80,10 +78,8 @@ IMPL_XTYPEPROVIDER_END
 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
 
 	SvMemoryStream aMem;
-	aMem << maBitmap.GetMask();
+    WriteDIB(maBitmap.GetMask(), aMem, false, true);
 	return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
 }
 
-
-
-
+// eof

Modified: openoffice/branches/alg/clibboard/main/toolkit/source/helper/vclunohelper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/toolkit/source/helper/vclunohelper.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/toolkit/source/helper/vclunohelper.cxx (original)
+++ openoffice/branches/alg/clibboard/main/toolkit/source/helper/vclunohelper.cxx Fri Jan  4 22:58:25 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_toolkit.hxx"
 
@@ -42,9 +40,7 @@
 #include <com/sun/star/awt/MouseButton.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/embed/EmbedMapUnits.hpp>
-
 #include <com/sun/star/graphic/XGraphic.hpp>
-
 #include <toolkit/helper/vclunohelper.hxx>
 #include <toolkit/helper/convert.hxx>
 #include <toolkit/awt/vclxbitmap.hxx>
@@ -55,12 +51,11 @@
 #include <toolkit/awt/vclxfont.hxx>
 #include <toolkit/controls/unocontrolcontainer.hxx>
 #include <toolkit/controls/unocontrolcontainermodel.hxx>
-
 #include <vcl/graph.hxx>
 #include <comphelper/processfactory.hxx>
-
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/awt/Point.hpp>
+#include <vcl/dibtools.hxx>
 
 using namespace ::com::sun::star;
 
@@ -101,12 +96,12 @@ BitmapEx VCLUnoHelper::GetBitmap( const 
 			{
 				::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getDIB();
 				SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
-				aMem >> aDIB;
+                ReadDIB(aDIB, aMem, true);
 			}
 			{
 				::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getMaskDIB();
 				SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
-				aMem >> aMask;
+                ReadDIB(aMask, aMem, true);
 			}
 			aBmp = BitmapEx( aDIB, aMask );
 		}

Modified: openoffice/branches/alg/clibboard/main/vcl/Library_vcl.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/Library_vcl.mk?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/Library_vcl.mk (original)
+++ openoffice/branches/alg/clibboard/main/vcl/Library_vcl.mk Fri Jan  4 22:58:25 2013
@@ -321,7 +321,6 @@ $(eval $(call gb_Library_add_exception_o
     vcl/source/gdi/alpha \
     vcl/source/gdi/animate \
     vcl/source/gdi/base14 \
-    vcl/source/gdi/bitmap2 \
     vcl/source/gdi/bitmap3 \
     vcl/source/gdi/bitmap4 \
     vcl/source/gdi/bitmap \
@@ -334,6 +333,7 @@ $(eval $(call gb_Library_add_exception_o
     vcl/source/gdi/configsettings \
     vcl/source/gdi/cvtgrf \
     vcl/source/gdi/cvtsvm \
+    vcl/source/gdi/dibtools \
     vcl/source/gdi/extoutdevdata \
     vcl/source/gdi/font \
     vcl/source/gdi/gdimtf \

Modified: openoffice/branches/alg/clibboard/main/vcl/Package_inc.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/Package_inc.mk?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/Package_inc.mk (original)
+++ openoffice/branches/alg/clibboard/main/vcl/Package_inc.mk Fri Jan  4 22:58:25 2013
@@ -30,6 +30,7 @@ $(eval $(call gb_Package_add_file,vcl_in
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/arrange.hxx,vcl/arrange.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/bitmapex.hxx,vcl/bitmapex.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/bitmap.hxx,vcl/bitmap.hxx))
+$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/dibtools.hxx,vcl/dibtools.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/bmpacc.hxx,vcl/bmpacc.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/btndlg.hxx,vcl/btndlg.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/button.hxx,vcl/button.hxx))

Modified: openoffice/branches/alg/clibboard/main/vcl/inc/vcl/alpha.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/inc/vcl/alpha.hxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/inc/vcl/alpha.hxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/inc/vcl/alpha.hxx Fri Jan  4 22:58:25 2013
@@ -36,11 +36,10 @@ class BitmapEx;
 
 class VCL_DLLPUBLIC AlphaMask : private Bitmap
 {
+private:
 	friend class BitmapEx;
 	friend class OutputDevice;
-	friend VCL_DLLPUBLIC SvStream& operator<<( SvStream&, const ImageList& );
-
-private:
+    friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm);
 
 	SAL_DLLPRIVATE const Bitmap&    ImplGetBitmap() const;
 	SAL_DLLPRIVATE void             ImplSetBitmap( const Bitmap& rBitmap );
@@ -97,14 +96,7 @@ public:
     BitmapReadAccess*		AcquireReadAccess() { return Bitmap::AcquireReadAccess(); }
     BitmapWriteAccess*		AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); }
     void					ReleaseAccess( BitmapReadAccess* pAccess );
-
-public:
-
-    sal_Bool					Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True ) { return Bitmap::Read( rIStm, bFileHeader ); }
-	sal_Bool					Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const { return Bitmap::Write( rOStm, bCompressed, bFileHeader ); }
-
-	friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
-	friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
 };
 
 #endif // _SV_ALPHA_HXX
+// eof

Modified: openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmap.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmap.hxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmap.hxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmap.hxx Fri Jan  4 22:58:25 2013
@@ -343,8 +343,6 @@ class   BitmapWriteAccess;
 class   BitmapPalette;
 class   ImpBitmap;
 class   Color;
-class   SvStream;
-struct  DIBInfoHeader;
 class   ResId;
 class	GDIMetaFile;
 class	AlphaMask;
@@ -383,20 +381,6 @@ public:
     SAL_DLLPRIVATE void                 ImplSetImpBitmap( ImpBitmap* pImpBmp );
     SAL_DLLPRIVATE void                 ImplAssignWithSize( const Bitmap& rBitmap );
 
-    SAL_DLLPRIVATE static sal_Bool          ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset );
-    SAL_DLLPRIVATE static sal_Bool          ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset );
-    SAL_DLLPRIVATE static sal_Bool          ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown );
-    SAL_DLLPRIVATE static sal_Bool          ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, sal_Bool bQuad );
-    SAL_DLLPRIVATE static sal_Bool          ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown );
-    SAL_DLLPRIVATE sal_Bool                 ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool bCompressed ) const;
-    SAL_DLLPRIVATE static sal_Bool          ImplWriteDIBFileHeader( SvStream& rOStm, BitmapReadAccess& rAcc );
-    SAL_DLLPRIVATE static sal_Bool          ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc );
-    SAL_DLLPRIVATE static sal_Bool          ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc,
-                                                             sal_uLong nCompression, sal_uInt32& rImageSize );
-    SAL_DLLPRIVATE static void          ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader,
-                                           BitmapWriteAccess& rAcc, sal_Bool bRLE4 );
-    SAL_DLLPRIVATE static sal_Bool          ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool bRLE4 );
-
     SAL_DLLPRIVATE void                     ImplAdaptBitCount(Bitmap& rNew) const;
     SAL_DLLPRIVATE sal_Bool                 ImplScaleFast( const double& rScaleX, const double& rScaleY );
     SAL_DLLPRIVATE sal_Bool                 ImplScaleInterpolate( const double& rScaleX, const double& rScaleY );
@@ -878,18 +862,9 @@ public:
 									const BmpFilterParam* pFilterParam = NULL,
 									const Link* pProgress = NULL );
 
-public:
     BitmapReadAccess*       AcquireReadAccess();
     BitmapWriteAccess*      AcquireWriteAccess();
     void                    ReleaseAccess( BitmapReadAccess* pAccess );
-
-public:
-
-    sal_Bool                    Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True );
-    sal_Bool                    Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const;
-
-    friend VCL_DLLPUBLIC SvStream&        operator>>( SvStream& rIStm, Bitmap& rBitmap );
-    friend VCL_DLLPUBLIC SvStream&        operator<<( SvStream& rOStm, const Bitmap& rBitmap );
 };
 
 // -----------

Modified: openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmapex.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmapex.hxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmapex.hxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/inc/vcl/bitmapex.hxx Fri Jan  4 22:58:25 2013
@@ -46,9 +46,9 @@ enum TransparentType
 
 class VCL_DLLPUBLIC BitmapEx
 {
-	friend class ImpGraphic;
-
 private:
+	friend class ImpGraphic;
+    friend bool VCL_DLLPUBLIC WriteDIBBitmapEx(const BitmapEx& rSource, SvStream& rOStm);
 
 	Bitmap				aBitmap;
 	Bitmap				aMask;
@@ -59,15 +59,9 @@ private:
 
 public:
 
-//#if 0 // _SOLAR__PRIVATE
-
     SAL_DLLPRIVATE  ImpBitmap*  ImplGetBitmapImpBitmap() const { return aBitmap.ImplGetImpBitmap(); }
     SAL_DLLPRIVATE  ImpBitmap*  ImplGetMaskImpBitmap() const { return aMask.ImplGetImpBitmap(); }
 
-//#endif // PRIVATE
-
-public:
-
 						BitmapEx();
 						BitmapEx( const ResId& rResId );
 						BitmapEx( const BitmapEx& rBitmapEx );
@@ -386,11 +380,6 @@ public:
                 0 is not transparent, 255 is fully transparent
      */
     sal_uInt8 GetTransparency(sal_Int32 nX, sal_Int32 nY) const;
-
-public:
-
-	friend VCL_DLLPUBLIC SvStream&	operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
-	friend VCL_DLLPUBLIC SvStream&	operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
 };
 
 #endif // _SV_BITMAPEX_HXX

Added: openoffice/branches/alg/clibboard/main/vcl/inc/vcl/dibtools.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/inc/vcl/dibtools.hxx?rev=1429165&view=auto
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/inc/vcl/dibtools.hxx (added)
+++ openoffice/branches/alg/clibboard/main/vcl/inc/vcl/dibtools.hxx Fri Jan  4 22:58:25 2013
@@ -0,0 +1,77 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef _SV_DIBTOOLS_HXX
+#define _SV_DIBTOOLS_HXX
+
+#include <vcl/sv.h>
+#include <vcl/dllapi.h>
+#include <vcl/mapmod.hxx>
+#include <tools/rc.hxx>
+#include <vcl/region.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class SvStream;
+class BitmapEx;
+class Bitmap;
+
+//////////////////////////////////////////////////////////////////////////////
+
+bool VCL_DLLPUBLIC ReadDIB( // ReadDIB(rBitmap, rIStm, true);
+    Bitmap& rTarget, 
+    SvStream& rIStm, 
+    bool bFileHeader);
+
+bool VCL_DLLPUBLIC ReadDIBBitmapEx(
+    BitmapEx& rTarget, 
+    SvStream& rIStm);
+
+bool VCL_DLLPUBLIC ReadDIBV5(
+    Bitmap& rTarget, 
+    Bitmap& rTargetAlpha, 
+    SvStream& rIStm);
+
+//////////////////////////////////////////////////////////////////////////////
+
+bool VCL_DLLPUBLIC WriteDIB( // WriteDIB(rBitmap, rOStm, false, true);
+    const Bitmap& rSource, 
+    SvStream& rOStm, 
+    bool bCompressed, 
+    bool bFileHeader);
+
+bool VCL_DLLPUBLIC WriteDIBBitmapEx(
+    const BitmapEx& rSource, 
+    SvStream& rOStm);
+
+bool VCL_DLLPUBLIC WriteDIBV5(
+    const Bitmap& rSource, 
+    const Bitmap& rSourceAlpha, 
+    SvStream& rOStm);
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SV_DIBTOOLS_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+

Propchange: openoffice/branches/alg/clibboard/main/vcl/inc/vcl/dibtools.hxx
------------------------------------------------------------------------------
    svn:executable = *

Modified: openoffice/branches/alg/clibboard/main/vcl/inc/vcl/salbtype.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/inc/vcl/salbtype.hxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/inc/vcl/salbtype.hxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/inc/vcl/salbtype.hxx Fri Jan  4 22:58:25 2013
@@ -255,6 +255,7 @@ public:
 	inline void 		SetColorFor24Bit( const BitmapColor& rColor, HPBYTE pPixel ) const;
 
 	inline void 		GetColorFor32Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const;
+	inline void 		GetColorAndAlphaFor32Bit( BitmapColor& rColor, sal_uInt8& rAlpha, ConstHPBYTE pPixel ) const;
 	inline void 		SetColorFor32Bit( const BitmapColor& rColor, HPBYTE pPixel ) const;
 };
 
@@ -880,6 +881,21 @@ inline void ColorMask::GetColorFor32Bit(
 
 // ------------------------------------------------------------------
 
+inline void ColorMask::GetColorAndAlphaFor32Bit( BitmapColor& rColor, sal_uInt8& rAlpha, ConstHPBYTE pPixel ) const
+{
+#ifdef OSL_BIGENDIAN
+	const sal_uInt32 nVal = (sal_uInt32) pPixel[ 0 ] | ( (sal_uInt32) pPixel[ 1 ] << 8UL ) |
+						( (sal_uInt32) pPixel[ 2 ] << 16UL ) | ( (sal_uInt32) pPixel[ 3 ] << 24UL );
+#else
+	const sal_uInt32 nVal = *(sal_uInt32*) pPixel;
+#endif
+    rAlpha = (sal_uInt8)(nVal >> 24);
+
+	MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor );
+}
+
+// ------------------------------------------------------------------
+
 inline void ColorMask::SetColorFor32Bit( const BitmapColor& rColor, HPBYTE pPixel ) const
 {
 #ifdef OSL_BIGENDIAN

Modified: openoffice/branches/alg/clibboard/main/vcl/inc/vcl/wall.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/inc/vcl/wall.hxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/inc/vcl/wall.hxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/inc/vcl/wall.hxx Fri Jan  4 22:58:25 2013
@@ -97,7 +97,7 @@ public:
 					Wallpaper();
 					Wallpaper( const Wallpaper& rWallpaper );
 					Wallpaper( const Color& rColor );
-					Wallpaper( const BitmapEx& rBmpEx );
+					explicit Wallpaper( const BitmapEx& rBmpEx );
 					Wallpaper( const Gradient& rGradient );
 					~Wallpaper();
 

Modified: openoffice/branches/alg/clibboard/main/vcl/source/gdi/animate.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/source/gdi/animate.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/source/gdi/animate.cxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/source/gdi/animate.cxx Fri Jan  4 22:58:25 2013
@@ -32,6 +32,8 @@
 #include <vcl/virdev.hxx>
 #include <vcl/window.hxx>
 #include <impanmvw.hxx>
+#include <vcl/dibtools.hxx>
+
 DBG_NAME( Animation )
 
 // -----------
@@ -830,9 +832,9 @@ SvStream& operator<<( SvStream& rOStm, c
 		// Falls keine BitmapEx gesetzt wurde, schreiben wir
 		// einfach die erste Bitmap der Animation
 		if( !rAnimation.GetBitmapEx().GetBitmap() )
-			rOStm << rAnimation.Get( 0 ).aBmpEx;
+			WriteDIBBitmapEx(rAnimation.Get( 0 ).aBmpEx, rOStm);
 		else
-			rOStm << rAnimation.GetBitmapEx();
+			WriteDIBBitmapEx(rAnimation.GetBitmapEx(), rOStm);
 
 		// Kennung schreiben ( SDANIMA1 )
 		rOStm << (sal_uInt32) 0x5344414e << (sal_uInt32) 0x494d4931;
@@ -843,7 +845,7 @@ SvStream& operator<<( SvStream& rOStm, c
 			const sal_uInt16			nRest = nCount - i - 1;
 
 			// AnimationBitmap schreiben
-			rOStm << rAnimBmp.aBmpEx;
+			WriteDIBBitmapEx(rAnimBmp.aBmpEx, rOStm);
 			rOStm << rAnimBmp.aPosPix;
 			rOStm << rAnimBmp.aSizePix;
 			rOStm << rAnimation.maGlobalSize;
@@ -886,7 +888,7 @@ SvStream& operator>>( SvStream& rIStm, A
 	else
 	{
 		rIStm.Seek( nStmPos );
-		rIStm >> rAnimation.maBitmapEx;
+        ReadDIBBitmapEx(rAnimation.maBitmapEx, rIStm);
 		nStmPos = rIStm.Tell();
 		rIStm >> nAnimMagic1 >> nAnimMagic2;
 
@@ -908,7 +910,7 @@ SvStream& operator>>( SvStream& rIStm, A
 
 		do
 		{
-			rIStm >> aAnimBmp.aBmpEx;
+            ReadDIBBitmapEx(aAnimBmp.aBmpEx, rIStm);
 			rIStm >> aAnimBmp.aPosPix;
 			rIStm >> aAnimBmp.aSizePix;
 			rIStm >> rAnimation.maGlobalSize;

Modified: openoffice/branches/alg/clibboard/main/vcl/source/gdi/bitmapex.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/source/gdi/bitmapex.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/source/gdi/bitmapex.cxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/source/gdi/bitmapex.cxx Fri Jan  4 22:58:25 2013
@@ -19,19 +19,14 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
 #include <ctype.h>
-
 #include <rtl/crc.h>
-
 #include <tools/stream.hxx>
 #include <tools/debug.hxx>
 #include <tools/rc.h>
-
 #include <vcl/salbtype.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/alpha.hxx>
@@ -39,7 +34,7 @@
 #include <vcl/pngread.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/bmpacc.hxx>
-
+#include <vcl/dibtools.hxx>
 #include <image.h>
 #include <impimagetree.hxx>
 
@@ -838,85 +833,4 @@ sal_uInt8 BitmapEx::GetTransparency(sal_
 }
 
 // ------------------------------------------------------------------
-
-SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx )
-{
-	rBitmapEx.aBitmap.Write( rOStm );
-
-	rOStm << (sal_uInt32) 0x25091962;
-	rOStm << (sal_uInt32) 0xACB20201;
-	rOStm << (sal_uInt8) rBitmapEx.eTransparent;
-
-	if( rBitmapEx.eTransparent == TRANSPARENT_BITMAP )
-		rBitmapEx.aMask.Write( rOStm );
-	else if( rBitmapEx.eTransparent == TRANSPARENT_COLOR )
-		rOStm << rBitmapEx.aTransparentColor;
-
-	return rOStm;
-}
-
-// ------------------------------------------------------------------
-
-SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx )
-{
-	Bitmap aBmp;
-
-	rIStm >> aBmp;
-
-	if( !rIStm.GetError() )
-	{
-		const sal_uLong nStmPos = rIStm.Tell();
-		sal_uInt32		nMagic1 = 0;
-		sal_uInt32		nMagic2 = 0;
-
-		rIStm >> nMagic1 >> nMagic2;
-
-		if( ( nMagic1 != 0x25091962 ) || ( nMagic2 != 0xACB20201 ) || rIStm.GetError() )
-		{
-			rIStm.ResetError();
-			rIStm.Seek( nStmPos );
-			rBitmapEx = aBmp;
-		}
-		else
-		{
-			sal_uInt8 bTransparent = false;
-
-			rIStm >> bTransparent;
-
-			if( bTransparent == (sal_uInt8) TRANSPARENT_BITMAP )
-			{
-				Bitmap aMask;
-
-				rIStm >> aMask;
-
-				if( !!aMask)
-				{
-					// do we have an alpha mask?
-					if( ( 8 == aMask.GetBitCount() ) && aMask.HasGreyPalette() )
-					{
-						AlphaMask aAlpha;
-
-						// create alpha mask quickly (without greyscale conversion)
-						aAlpha.ImplSetBitmap( aMask );
-						rBitmapEx = BitmapEx( aBmp, aAlpha );
-					}
-					else
-						rBitmapEx = BitmapEx( aBmp, aMask );
-				}
-				else
-					rBitmapEx = aBmp;
-			}
-			else if( bTransparent == (sal_uInt8) TRANSPARENT_COLOR )
-			{
-				Color aTransparentColor;
-
-				rIStm >> aTransparentColor;
-				rBitmapEx = BitmapEx( aBmp, aTransparentColor );
-			}
-			else
-				rBitmapEx = aBmp;
-		}
-	}
-
-	return rIStm;
-}
+// eof

Modified: openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpacc2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpacc2.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpacc2.cxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpacc2.cxx Fri Jan  4 22:58:25 2013
@@ -315,7 +315,7 @@ IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_R
 IMPL_FORMAT_GETPIXEL( _32BIT_TC_MASK )
 {
 	BitmapColor aColor;
-	rMask.GetColorFor32Bit( aColor, pScanline + ( nX << 2UL ) );
+    rMask.GetColorFor32Bit( aColor, pScanline + ( nX << 2UL ) );
 	return aColor;
 }
 

Modified: openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpconv.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpconv.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpconv.cxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/source/gdi/bmpconv.cxx Fri Jan  4 22:58:25 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
@@ -32,7 +30,7 @@
 #include "com/sun/star/script/XInvocation.hpp"
 #include "com/sun/star/awt/XBitmap.hpp"
 #include "cppuhelper/compbase1.hxx"
-
+#include <vcl/dibtools.hxx>
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::script;
@@ -149,7 +147,9 @@ Any SAL_CALL BmpConverter::invoke(
 
         SvMemoryStream aStream( aDIB.getArray(), aDIB.getLength(), STREAM_READ | STREAM_WRITE );
         Bitmap aBM;
-        aBM.Read( aStream, sal_True );
+        
+        ReadDIB(aBM, aStream, true);
+        
         if( nTargetDepth < 4 )
             nTargetDepth = 1;
         else if( nTargetDepth < 8 )
@@ -183,8 +183,11 @@ BmpTransporter::BmpTransporter( const Bi
 {
     m_aSize.Width = rBM.GetSizePixel().Width();
     m_aSize.Height = rBM.GetSizePixel().Height();
+    
     SvMemoryStream aStream;
-    rBM.Write( aStream, sal_False, sal_True );
+
+    WriteDIB(rBM, aStream, false, true);
+
     m_aBM = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aStream.GetData()),
                 aStream.GetEndOfData());
 }

Modified: openoffice/branches/alg/clibboard/main/vcl/source/gdi/cvtsvm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/clibboard/main/vcl/source/gdi/cvtsvm.cxx?rev=1429165&r1=1429164&r2=1429165&view=diff
==============================================================================
--- openoffice/branches/alg/clibboard/main/vcl/source/gdi/cvtsvm.cxx (original)
+++ openoffice/branches/alg/clibboard/main/vcl/source/gdi/cvtsvm.cxx Fri Jan  4 22:58:25 2013
@@ -36,6 +36,7 @@
 #include <vcl/lineinfo.hxx>
 #include <vcl/salbtype.hxx>
 #include <vcl/cvtsvm.hxx>
+#include <vcl/dibtools.hxx>
 
 // -----------
 // - Defines -
@@ -983,7 +984,8 @@ void SVMConverter::ImplConvertFromSVM1( 
 				{
 					Bitmap aBmp;
 
-					rIStm >> aPt >> aBmp;
+					rIStm >> aPt;
+                    ReadDIB(aBmp, rIStm, true);
 					rMtf.AddAction( new MetaBmpAction( aPt, aBmp ) );
 				}
 				break;
@@ -992,7 +994,8 @@ void SVMConverter::ImplConvertFromSVM1( 
 				{
 					Bitmap aBmp;
 
-					rIStm >> aPt >> aSz >> aBmp;
+					rIStm >> aPt >> aSz;
+                    ReadDIB(aBmp, rIStm, true);
 					rMtf.AddAction( new MetaBmpScaleAction( aPt, aSz, aBmp ) );
 				}
 				break;
@@ -1002,7 +1005,8 @@ void SVMConverter::ImplConvertFromSVM1( 
 					Bitmap	aBmp;
 					Size	aSz2;
 
-					rIStm >> aPt >> aSz >> aPt1 >> aSz2 >> aBmp;
+					rIStm >> aPt >> aSz >> aPt1 >> aSz2;
+                    ReadDIB(aBmp, rIStm, true);
 					rMtf.AddAction( new MetaBmpScalePartAction( aPt, aSz, aPt1, aSz2, aBmp ) );
 				}
 				break;
@@ -1827,7 +1831,7 @@ sal_uLong SVMConverter::ImplWriteActions
 				rOStm << (sal_Int16) GDI_BITMAP_ACTION;
 				rOStm << (sal_Int32) 12;
 				rOStm << pAct->GetPoint();
-				rOStm << pAct->GetBitmap();
+                WriteDIB(pAct->GetBitmap(), rOStm, false, true);
 				nCount++;
 			}
 			break;
@@ -1840,7 +1844,7 @@ sal_uLong SVMConverter::ImplWriteActions
 				rOStm << (sal_Int32) 20;
 				rOStm << pAct->GetPoint();
 				rOStm << pAct->GetSize();
-				rOStm << pAct->GetBitmap();
+                WriteDIB(pAct->GetBitmap(), rOStm, false, true);
 				nCount++;
 			}
 			break;
@@ -1855,7 +1859,7 @@ sal_uLong SVMConverter::ImplWriteActions
 				rOStm << pAct->GetDestSize();
 				rOStm << pAct->GetSrcPoint();
 				rOStm << pAct->GetSrcSize();
-				rOStm << pAct->GetBitmap();
+                WriteDIB(pAct->GetBitmap(), rOStm, false, true);
 				nCount++;
 			}
 			break;
@@ -1868,7 +1872,7 @@ sal_uLong SVMConverter::ImplWriteActions
 				rOStm << (sal_Int16) GDI_BITMAP_ACTION;
 				rOStm << (sal_Int32) 12;
 				rOStm << pAct->GetPoint();
-				rOStm << aBmp;
+                WriteDIB(aBmp, rOStm, false, true);
 				nCount++;
 			}
 			break;
@@ -1882,7 +1886,7 @@ sal_uLong SVMConverter::ImplWriteActions
 				rOStm << (sal_Int32) 20;
 				rOStm << pAct->GetPoint();
 				rOStm << pAct->GetSize();
-				rOStm << aBmp;
+                WriteDIB(aBmp, rOStm, false, true);
 				nCount++;
 			}
 			break;
@@ -1898,7 +1902,7 @@ sal_uLong SVMConverter::ImplWriteActions
 				rOStm << pAct->GetDestSize();
 				rOStm << pAct->GetSrcPoint();
 				rOStm << pAct->GetSrcSize();
-				rOStm << aBmp;
+                WriteDIB(aBmp, rOStm, false, true);
 				nCount++;
 			}
 			break;