diff options
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/misc/transfer.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 0371ea8276eb..ccad405e1fce 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -60,6 +60,7 @@ #include <vcl/dibtools.hxx> #include <vcl/pngread.hxx> #include <vcl/pngwrite.hxx> +#include <vcl/graphicfilter.hxx> #include <memory> // - Namespaces - @@ -1628,11 +1629,19 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r DataFlavor aSubstFlavor; bool bRet(GetSotStorageStream(rFlavor, xStm)); bool bSuppressPNG(false); // #122982# If PNG stream not accessed, but BMP one, suppress trying to load PNG + bool bSuppressJPEG(false); if(!bRet && HasFormat(SotClipboardFormatId::PNG) && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aSubstFlavor)) { // when no direct success, try if PNG is available bRet = GetSotStorageStream(aSubstFlavor, xStm); + bSuppressJPEG = bRet; + } + + if(!bRet && HasFormat(SotClipboardFormatId::JPEG) && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::JPEG, aSubstFlavor)) + { + bRet = GetSotStorageStream(aSubstFlavor, xStm); + bSuppressPNG = bRet; } if(!bRet && HasFormat(SotClipboardFormatId::BMP) && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::BMP, aSubstFlavor)) @@ -1640,6 +1649,7 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r // when no direct success, try if BMP is available bRet = GetSotStorageStream(aSubstFlavor, xStm); bSuppressPNG = bRet; + bSuppressJPEG = bRet; } if(bRet) @@ -1651,6 +1661,14 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r rBmpEx = aPNGReader.Read(); } + else if(!bSuppressJPEG && rFlavor.MimeType.equalsIgnoreAsciiCase("image/jpeg")) + { + // it's a JPEG, import to BitmapEx + GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); + Graphic aGraphic; + if (rFilter.ImportGraphic(aGraphic, "", *xStm) == GRFILTER_OK) + rBmpEx = aGraphic.GetBitmapEx(); + } if(rBmpEx.IsEmpty()) { @@ -1800,6 +1818,13 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) ) rGraphic = aBmpEx; } + else if (SotExchange::GetFormatDataFlavor(SotClipboardFormatId::JPEG, aFlavor) && TransferableDataHelper::IsEqual(aFlavor, rFlavor)) + { + BitmapEx aBitmapEx; + + if ((bRet = GetBitmapEx(aFlavor, aBitmapEx))) + rGraphic = aBitmapEx; + } else if(SotExchange::GetFormatDataFlavor( SotClipboardFormatId::BITMAP, aFlavor ) && TransferableDataHelper::IsEqual( aFlavor, rFlavor ) ) { |