The PICT format was formally deprecated already in OS X v10.4
The documentation says: "The PICT format was formally deprecated in OS X v10.4 along with QuickDraw. You should not be explicitly providing or looking for PICT data on the pasteboard." Change-Id: I01cc600286f9a2933a91e19bb611df08944ab997
This commit is contained in:
@@ -109,15 +109,6 @@ namespace // private
|
|||||||
bool DataTypeOUString; // sequence<byte> otherwise
|
bool DataTypeOUString; // sequence<byte> otherwise
|
||||||
};
|
};
|
||||||
|
|
||||||
// NSPICTPboardType is deprecated in 10.6 and later
|
|
||||||
|
|
||||||
// Make deprecation warnings just warnings even in a -Werror
|
|
||||||
// compilation.
|
|
||||||
|
|
||||||
#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY
|
|
||||||
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* At the moment it appears as if only MS Office pastes "public.html" to the clipboard.
|
/* At the moment it appears as if only MS Office pastes "public.html" to the clipboard.
|
||||||
*/
|
*/
|
||||||
FlavorMap flavorMap[] =
|
FlavorMap flavorMap[] =
|
||||||
@@ -125,7 +116,6 @@ namespace // private
|
|||||||
{ NSStringPboardType, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", true },
|
{ NSStringPboardType, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", true },
|
||||||
{ NSRTFPboardType, "text/richtext", "Rich Text Format", false },
|
{ NSRTFPboardType, "text/richtext", "Rich Text Format", false },
|
||||||
{ NSTIFFPboardType, "image/png", "Portable Network Graphics", false },
|
{ NSTIFFPboardType, "image/png", "Portable Network Graphics", false },
|
||||||
{ NSPICTPboardType, "image/png", "Portable Network Graphics", false },
|
|
||||||
{ NSHTMLPboardType, "text/html", "Plain Html", false },
|
{ NSHTMLPboardType, "text/html", "Plain Html", false },
|
||||||
{ NSFilenamesPboardType, "application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", false },
|
{ NSFilenamesPboardType, "application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", false },
|
||||||
{ PBTYPE_SESX, FLAVOR_SESX, "Star Embed Source (XML)", false },
|
{ PBTYPE_SESX, FLAVOR_SESX, "Star Embed Source (XML)", false },
|
||||||
@@ -573,7 +563,7 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor
|
|||||||
|
|
||||||
NSString* DataFlavorMapper::openOfficeImageToSystemFlavor(NSPasteboard* pPasteboard) const
|
NSString* DataFlavorMapper::openOfficeImageToSystemFlavor(NSPasteboard* pPasteboard) const
|
||||||
{
|
{
|
||||||
NSArray *supportedTypes = [NSArray arrayWithObjects: NSTIFFPboardType, NSPICTPboardType, nil];
|
NSArray *supportedTypes = [NSArray arrayWithObjects: NSTIFFPboardType, nil];
|
||||||
NSString *sysFlavor = [pPasteboard availableTypeFromArray:supportedTypes];
|
NSString *sysFlavor = [pPasteboard availableTypeFromArray:supportedTypes];
|
||||||
return sysFlavor;
|
return sysFlavor;
|
||||||
}
|
}
|
||||||
@@ -602,11 +592,7 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
*/
|
*/
|
||||||
if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame)
|
if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame)
|
||||||
{
|
|
||||||
dp = DataProviderPtr_t( new PNGDataProvider( data, PICTImageFileType));
|
|
||||||
}
|
|
||||||
else if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame)
|
|
||||||
{
|
{
|
||||||
dp = DataProviderPtr_t( new PNGDataProvider( data, NSTIFFFileType));
|
dp = DataProviderPtr_t( new PNGDataProvider( data, NSTIFFFileType));
|
||||||
}
|
}
|
||||||
@@ -653,10 +639,6 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(const NSString* systemFlavor
|
|||||||
{
|
{
|
||||||
dp = DataProviderPtr_t(new HTMLFormatDataProvider(systemData));
|
dp = DataProviderPtr_t(new HTMLFormatDataProvider(systemData));
|
||||||
}
|
}
|
||||||
else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame)
|
|
||||||
{
|
|
||||||
dp = DataProviderPtr_t( new PNGDataProvider(systemData, PICTImageFileType));
|
|
||||||
}
|
|
||||||
else if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame)
|
else if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame)
|
||||||
{
|
{
|
||||||
dp = DataProviderPtr_t( new PNGDataProvider(systemData, NSTIFFFileType));
|
dp = DataProviderPtr_t( new PNGDataProvider(systemData, NSTIFFFileType));
|
||||||
@@ -701,7 +683,6 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno:
|
|||||||
if( flavors[i].MimeType.startsWith("image/bmp") )
|
if( flavors[i].MimeType.startsWith("image/bmp") )
|
||||||
{
|
{
|
||||||
[array addObject: NSTIFFPboardType];
|
[array addObject: NSTIFFPboardType];
|
||||||
[array addObject: NSPICTPboardType];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -17,132 +17,20 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This is a work-around to prevent 'deprecated' warning for 'KillPicture' API
|
|
||||||
Hopefully we can get rid of this whole code again when the OOo PICT filter
|
|
||||||
are good enough to be used see #i78953 thus this hack would vanish to again.
|
|
||||||
*/
|
|
||||||
#include <premac.h>
|
#include <premac.h>
|
||||||
#include <AvailabilityMacros.h>
|
|
||||||
#undef DEPRECATED_ATTRIBUTE
|
|
||||||
#define DEPRECATED_ATTRIBUTE
|
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <QuickTime/QuickTime.h>
|
#include <QuickTime/QuickTime.h>
|
||||||
#include <postmac.h>
|
#include <postmac.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "PictToBmpFlt.hxx"
|
#include "PictToBmpFlt.hxx"
|
||||||
|
|
||||||
bool PICTtoPNG( com::sun::star::uno::Sequence<sal_Int8>& rPictData,
|
|
||||||
com::sun::star::uno::Sequence<sal_Int8>& rPngData)
|
|
||||||
{
|
|
||||||
#ifdef __LP64__
|
|
||||||
// FIXME
|
|
||||||
(void) rPictData;
|
|
||||||
(void) rPngData;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
ComponentInstance pngExporter = NULL;
|
|
||||||
if( OpenADefaultComponent( GraphicsExporterComponentType, kQTFileTypePNG, &pngExporter) != noErr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Handle hPict = NULL;
|
|
||||||
if( PtrToHand( rPictData.getArray(), &hPict, rPictData.getLength()) != noErr)
|
|
||||||
hPict = NULL;
|
|
||||||
|
|
||||||
Handle hPng = NULL;
|
|
||||||
if( hPict && GraphicsExportSetInputPicture( pngExporter, (PicHandle)hPict) == noErr)
|
|
||||||
hPng = NewHandleClear(0);
|
|
||||||
|
|
||||||
size_t nPngSize = 0;
|
|
||||||
if( hPng
|
|
||||||
&& (GraphicsExportSetOutputHandle( pngExporter, hPng) == noErr)
|
|
||||||
&& (GraphicsExportDoExport( pngExporter, NULL) == noErr))
|
|
||||||
{
|
|
||||||
nPngSize = GetHandleSize( hPng);
|
|
||||||
rPngData.realloc( nPngSize);
|
|
||||||
|
|
||||||
HLock( hPng);
|
|
||||||
memmove( rPngData.getArray(), ((sal_Int8*)*hPng), nPngSize);
|
|
||||||
HUnlock( hPng);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( hPict)
|
|
||||||
DisposeHandle( hPict);
|
|
||||||
if( hPng)
|
|
||||||
DisposeHandle( hPng);
|
|
||||||
if( pngExporter)
|
|
||||||
CloseComponent( pngExporter);
|
|
||||||
|
|
||||||
return (nPngSize > 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if MACOSX_SDK_VERSION >= 1070
|
|
||||||
|
|
||||||
// This whole thing needs to be rewritten I guess. Or does this code
|
|
||||||
// even get invoked on current OSes? Given that KillPicture() was
|
|
||||||
// deprecated already in 10.4, back when somebody was actually working
|
|
||||||
// on this code, hopefully knowing what he/she was doing, did he/she
|
|
||||||
// really not pay attention and notice that this stuff is going to go
|
|
||||||
// away?
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
extern void KillPicture(PicHandle myPicture);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool PNGtoPICT( com::sun::star::uno::Sequence<sal_Int8>& rPngData,
|
|
||||||
com::sun::star::uno::Sequence<sal_Int8>& rPictData)
|
|
||||||
{
|
|
||||||
#ifdef __LP64__
|
|
||||||
// FIXME
|
|
||||||
(void) rPngData;
|
|
||||||
(void) rPictData;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
ComponentInstance pictExporter;
|
|
||||||
if( OpenADefaultComponent( GraphicsImporterComponentType, kQTFileTypePNG, &pictExporter) != noErr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Handle hPng = NULL;
|
|
||||||
if( PtrToHand( rPngData.getArray(), &hPng, rPngData.getLength()) != noErr)
|
|
||||||
hPng = NULL;
|
|
||||||
|
|
||||||
size_t nPictSize = 0;
|
|
||||||
PicHandle hPict = NULL;
|
|
||||||
if( hPng
|
|
||||||
&& (GraphicsImportSetDataHandle( pictExporter, hPng) == noErr)
|
|
||||||
&& (GraphicsImportGetAsPicture( pictExporter, &hPict) == noErr))
|
|
||||||
{
|
|
||||||
nPictSize = GetHandleSize( (Handle)hPict);
|
|
||||||
rPictData.realloc( nPictSize);
|
|
||||||
|
|
||||||
HLock( (Handle)hPict);
|
|
||||||
memmove( rPictData.getArray(), ((sal_Int8*)*hPict), nPictSize);
|
|
||||||
HUnlock( (Handle)hPict);
|
|
||||||
|
|
||||||
// Release the data associated with the picture
|
|
||||||
// Note: This function is deprecated in Mac OSX 10.4
|
|
||||||
KillPicture( hPict);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( hPng)
|
|
||||||
DisposeHandle( hPng);
|
|
||||||
if( pictExporter)
|
|
||||||
CloseComponent( pictExporter);
|
|
||||||
|
|
||||||
return (nPictSize > 512);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImageToPNG( com::sun::star::uno::Sequence<sal_Int8>& rImgData,
|
bool ImageToPNG( com::sun::star::uno::Sequence<sal_Int8>& rImgData,
|
||||||
com::sun::star::uno::Sequence<sal_Int8>& rPngData,
|
com::sun::star::uno::Sequence<sal_Int8>& rPngData,
|
||||||
NSBitmapImageFileType eInFormat)
|
NSBitmapImageFileType eInFormat)
|
||||||
{
|
{
|
||||||
if( eInFormat == PICTImageFileType)
|
(void) eInFormat; // Really not needed? Weird.
|
||||||
return PICTtoPNG( rImgData, rPngData);
|
|
||||||
|
|
||||||
NSData* pData = [NSData dataWithBytesNoCopy: (void*)rImgData.getConstArray() length: rImgData.getLength() freeWhenDone: 0];
|
NSData* pData = [NSData dataWithBytesNoCopy: (void*)rImgData.getConstArray() length: rImgData.getLength() freeWhenDone: 0];
|
||||||
if( !pData)
|
if( !pData)
|
||||||
@@ -167,9 +55,6 @@ bool PNGToImage( com::sun::star::uno::Sequence<sal_Int8>& rPngData,
|
|||||||
NSBitmapImageFileType eOutFormat
|
NSBitmapImageFileType eOutFormat
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( eOutFormat == PICTImageFileType)
|
|
||||||
return PNGtoPICT( rPngData, rImgData);
|
|
||||||
|
|
||||||
NSData* pData = [NSData dataWithBytesNoCopy: const_cast<sal_Int8*>(rPngData.getConstArray()) length: rPngData.getLength() freeWhenDone: 0];
|
NSData* pData = [NSData dataWithBytesNoCopy: const_cast<sal_Int8*>(rPngData.getConstArray()) length: rPngData.getLength() freeWhenDone: 0];
|
||||||
if( !pData)
|
if( !pData)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -26,24 +26,6 @@
|
|||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
#include <postmac.h>
|
#include <postmac.h>
|
||||||
|
|
||||||
/** Transform an image from PICT to PNG format
|
|
||||||
|
|
||||||
Returns true if the conversion was successful false
|
|
||||||
otherwise.
|
|
||||||
*/
|
|
||||||
bool PICTtoPNG(com::sun::star::uno::Sequence<sal_Int8>& rPictData,
|
|
||||||
com::sun::star::uno::Sequence<sal_Int8>& rPngData);
|
|
||||||
|
|
||||||
/** Transform an image from PNG to a PICT format
|
|
||||||
|
|
||||||
Returns true if the conversion was successful false
|
|
||||||
otherwise.
|
|
||||||
*/
|
|
||||||
bool PNGtoPICT(com::sun::star::uno::Sequence<sal_Int8>& rPngData,
|
|
||||||
com::sun::star::uno::Sequence<sal_Int8>& rPictData);
|
|
||||||
|
|
||||||
#define PICTImageFileType ((NSBitmapImageFileType)~0)
|
|
||||||
|
|
||||||
bool ImageToPNG( com::sun::star::uno::Sequence<sal_Int8>& rImgData,
|
bool ImageToPNG( com::sun::star::uno::Sequence<sal_Int8>& rImgData,
|
||||||
com::sun::star::uno::Sequence<sal_Int8>& rPngData,
|
com::sun::star::uno::Sequence<sal_Int8>& rPngData,
|
||||||
NSBitmapImageFileType eInFormat);
|
NSBitmapImageFileType eInFormat);
|
||||||
|
Reference in New Issue
Block a user