[Libreoffice-commits] core.git: vcl/aqua

Tor Lillqvist tml at iki.fi
Mon Jun 17 12:49:42 PDT 2013


 vcl/aqua/source/dtrans/DataFlavorMapping.cxx |   23 -----
 vcl/aqua/source/dtrans/PictToBmpFlt.cxx      |  119 ---------------------------
 vcl/aqua/source/dtrans/PictToBmpFlt.hxx      |   18 ----
 3 files changed, 4 insertions(+), 156 deletions(-)

New commits:
commit e417ce79d97693ab21df7f37be1d86f6e0353a5f
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Jun 17 22:12:07 2013 +0300

    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

diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
index 4d04f7b..9458c57 100644
--- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
+++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
@@ -109,15 +109,6 @@ namespace // private
     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.
    */
   FlavorMap flavorMap[] =
@@ -125,7 +116,6 @@ namespace // private
       { NSStringPboardType, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", true },
       { NSRTFPboardType, "text/richtext", "Rich Text Format", false },
       { NSTIFFPboardType, "image/png", "Portable Network Graphics", false },
-      { NSPICTPboardType, "image/png", "Portable Network Graphics", false },
       { NSHTMLPboardType, "text/html", "Plain Html", false },
       { NSFilenamesPboardType, "application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", 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
 {
-    NSArray *supportedTypes = [NSArray arrayWithObjects: NSTIFFPboardType, NSPICTPboardType, nil];
+    NSArray *supportedTypes = [NSArray arrayWithObjects: NSTIFFPboardType, nil];
     NSString *sysFlavor = [pPasteboard availableTypeFromArray:supportedTypes];
     return sysFlavor;
 }
@@ -602,11 +592,7 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe
             }
           else
           */
-          if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame)
-            {
-              dp = DataProviderPtr_t( new PNGDataProvider( data, PICTImageFileType));
-            }
-          else if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame)
+          if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame)
             {
               dp = DataProviderPtr_t( new PNGDataProvider( data, NSTIFFFileType));
             }
@@ -653,10 +639,6 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(const NSString* systemFlavor
     {
       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)
     {
       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") )
       {
           [array addObject: NSTIFFPboardType];
-          [array addObject: NSPICTPboardType];
       }
       else
       {
diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
index 3d5c3a7..91ed2bc 100644
--- a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
+++ b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
@@ -17,132 +17,20 @@
  *   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 <AvailabilityMacros.h>
-#undef DEPRECATED_ATTRIBUTE
-#define DEPRECATED_ATTRIBUTE
-
 #include <Carbon/Carbon.h>
 #include <QuickTime/QuickTime.h>
 #include <postmac.h>
+
 #include <string.h>
 
 #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,
                  com::sun::star::uno::Sequence<sal_Int8>& rPngData,
                  NSBitmapImageFileType eInFormat)
 {
-    if( eInFormat == PICTImageFileType)
-        return PICTtoPNG( rImgData, rPngData);
+    (void) eInFormat; // Really not needed? Weird.
 
     NSData* pData = [NSData dataWithBytesNoCopy: (void*)rImgData.getConstArray() length: rImgData.getLength() freeWhenDone: 0];
     if( !pData)
@@ -167,9 +55,6 @@ bool PNGToImage( com::sun::star::uno::Sequence<sal_Int8>& rPngData,
                  NSBitmapImageFileType eOutFormat
                 )
 {
-    if( eOutFormat == PICTImageFileType)
-        return PNGtoPICT( rPngData, rImgData);
-
     NSData* pData = [NSData dataWithBytesNoCopy: const_cast<sal_Int8*>(rPngData.getConstArray()) length: rPngData.getLength() freeWhenDone: 0];
     if( !pData)
         return false;
diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.hxx b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx
index 12f2931..abff9a8 100644
--- a/vcl/aqua/source/dtrans/PictToBmpFlt.hxx
+++ b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx
@@ -26,24 +26,6 @@
 #include <Cocoa/Cocoa.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,
                  com::sun::star::uno::Sequence<sal_Int8>& rPngData,
                  NSBitmapImageFileType eInFormat);


More information about the Libreoffice-commits mailing list