Kaydet (Commit) 1156d1b2 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

Resolves: #i122982# Fallback to bitmap reader when no PNG even when claimed

(cherry picked from commit a77275c6)

Conflicts:
	svtools/source/misc/transfer.cxx

Change-Id: I213496c53558cd3b78e40866bdc8e89d08079033
üst 729bc005
...@@ -1694,6 +1694,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE ...@@ -1694,6 +1694,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
SotStorageStreamRef xStm; SotStorageStreamRef xStm;
DataFlavor aSubstFlavor; DataFlavor aSubstFlavor;
bool bRet(GetSotStorageStream(rFlavor, xStm)); bool bRet(GetSotStorageStream(rFlavor, xStm));
bool bSuppressPNG(false); // #122982# If PNG stream not accessed, but BMP one, suppress trying to load PNG
if(!bRet && HasFormat(SOT_FORMATSTR_ID_PNG) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aSubstFlavor)) if(!bRet && HasFormat(SOT_FORMATSTR_ID_PNG) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aSubstFlavor))
{ {
...@@ -1705,18 +1706,20 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE ...@@ -1705,18 +1706,20 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
{ {
// when no direct success, try if BMP is available // when no direct success, try if BMP is available
bRet = GetSotStorageStream(aSubstFlavor, xStm); bRet = GetSotStorageStream(aSubstFlavor, xStm);
bSuppressPNG = bRet;
} }
if(bRet) if(bRet)
{ {
if(rFlavor.MimeType.equalsIgnoreAsciiCase("image/png")) if(!bSuppressPNG && rFlavor.MimeType.equalsIgnoreAsciiCase("image/png"))
{ {
// it's a PNG, import to BitmapEx // it's a PNG, import to BitmapEx
::vcl::PNGReader aPNGReader(*xStm); ::vcl::PNGReader aPNGReader(*xStm);
rBmpEx = aPNGReader.Read(); rBmpEx = aPNGReader.Read();
} }
else
if(rBmpEx.IsEmpty())
{ {
Bitmap aBitmap; Bitmap aBitmap;
Bitmap aMask; Bitmap aMask;
...@@ -1734,7 +1737,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE ...@@ -1734,7 +1737,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
} }
} }
bRet = (ERRCODE_NONE == xStm->GetError()); bRet = (ERRCODE_NONE == xStm->GetError() && !rBmpEx.IsEmpty());
/* SJ: #110748# At the moment we are having problems with DDB inserted as DIB. The /* 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 problem is, that some graphics are inserted much too big because the nXPelsPerMeter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment