1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
21 #include <sal/log.hxx>
23 #include "DataFlavorMapping.hxx"
24 #include "HtmlFmtFlt.hxx"
25 #include "PictToBmpFlt.hxx"
26 #include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
27 #include <com/sun/star/datatransfer/XMimeContentType.hpp>
28 #include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
29 #include <com/sun/star/lang/IllegalArgumentException.hpp>
30 #include <com/sun/star/uno/Sequence.hxx>
31 #include <comphelper/processfactory.hxx>
33 #include <rtl/ustring.hxx>
34 #include <osl/endian.h>
40 #include <Cocoa/Cocoa.h>
43 using namespace ::com::sun::star::datatransfer
;
44 using namespace ::com::sun::star::uno
;
45 using namespace com::sun::star::lang
;
51 /* Determine whether or not a DataFlavor is valid.
53 bool isValidFlavor(const DataFlavor
& aFlavor
)
55 size_t len
= aFlavor
.MimeType
.getLength();
56 Type dtype
= aFlavor
.DataType
;
57 return ((len
> 0) && ((dtype
== cppu::UnoType
<Sequence
<sal_Int8
>>::get()) || (dtype
== cppu::UnoType
<OUString
>::get())));
60 OUString
NSStringToOUString( const NSString
* cfString
)
62 assert(cfString
&& "Invalid parameter");
64 const char* utf8Str
= [cfString UTF8String
];
65 unsigned int len
= rtl_str_getLength(utf8Str
);
67 return OUString(utf8Str
, len
, RTL_TEXTENCODING_UTF8
);
70 NSString
* OUStringToNSString(const OUString
& ustring
)
72 OString utf8Str
= OUStringToOString(ustring
, RTL_TEXTENCODING_UTF8
);
73 return [NSString stringWithCString
: utf8Str
.getStr() encoding
: NSUTF8StringEncoding
];
76 NSString
* PBTYPE_SODX
= @
"application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"";
77 NSString
* PBTYPE_SESX
= @
"application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"";
78 NSString
* PBTYPE_SLSDX
= @
"application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\"";
79 NSString
* PBTYPE_ESX
= @
"application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"";
80 NSString
* PBTYPE_LSX
= @
"application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\"";
81 NSString
* PBTYPE_EOX
= @
"application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\"";
82 NSString
* PBTYPE_SVXB
= @
"application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"";
83 NSString
* PBTYPE_GDIMF
= @
"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"";
84 NSString
* PBTYPE_WMF
= @
"application/x-openoffice-wmf;windows_formatname=\"Image WMF\"";
85 NSString
* PBTYPE_EMF
= @
"application/x-openoffice-emf;windows_formatname=\"Image EMF\"";
87 NSString
* PBTYPE_DUMMY_INTERNAL
= @
"application/x-openoffice-internal";
89 const char* FLAVOR_SODX
= "application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"";
90 const char* FLAVOR_SESX
= "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"";
91 const char* FLAVOR_SLSDX
= "application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\"";
92 const char* FLAVOR_ESX
= "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"";
93 const char* FLAVOR_LSX
= "application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\"";
94 const char* FLAVOR_EOX
= "application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\"";
95 const char* FLAVOR_SVXB
= "application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"";
96 const char* FLAVOR_GDIMF
= "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"";
97 const char* FLAVOR_WMF
= "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"";
98 const char* FLAVOR_EMF
= "application/x-openoffice-emf;windows_formatname=\"Image EMF\"";
100 const char* FLAVOR_DUMMY_INTERNAL
= "application/x-openoffice-internal";
104 const NSString
* SystemFlavor
;
105 const char* OOoFlavor
;
106 const char* HumanPresentableName
;
107 bool DataTypeOUString
; // sequence<byte> otherwise
110 /* At the moment it appears as if only MS Office pastes "public.html" to the clipboard.
112 static const FlavorMap flavorMap
[] =
114 { NSPasteboardTypeString
, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", true },
115 { NSPasteboardTypeRTF
, "text/rtf", "Rich Text Format", false },
116 { NSPasteboardTypePDF
, "application/pdf", "PDF File", false },
117 { NSPasteboardTypeTIFF
, "image/png", "Portable Network Graphics", false },
118 { NSPasteboardTypeHTML
, "text/html", "Plain Html", false },
119 SAL_WNODEPRECATED_DECLARATIONS_PUSH
120 // "'NSFilenamesPboardType' is deprecated: first deprecated in macOS 10.14 - Create
121 // multiple pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead"
122 { NSFilenamesPboardType
, "application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", false },
123 SAL_WNODEPRECATED_DECLARATIONS_POP
124 { PBTYPE_SESX
, FLAVOR_SESX
, "Star Embed Source (XML)", false },
125 { PBTYPE_SLSDX
, FLAVOR_SLSDX
, "Star Link Source Descriptor (XML)", false },
126 { PBTYPE_ESX
, FLAVOR_ESX
, "Star Embed Source (XML)", false },
127 { PBTYPE_LSX
, FLAVOR_LSX
, "Star Link Source (XML)", false },
128 { PBTYPE_EOX
, FLAVOR_EOX
, "Star Embedded Object (XML)", false },
129 { PBTYPE_SVXB
, FLAVOR_SVXB
, "SVXB (StarView Bitmap/Animation", false },
130 { PBTYPE_GDIMF
, FLAVOR_GDIMF
, "GDIMetaFile", false },
131 { PBTYPE_WMF
, FLAVOR_WMF
, "Windows MetaFile", false },
132 { PBTYPE_EMF
, FLAVOR_EMF
, "Windows Enhanced MetaFile", false },
133 { PBTYPE_SODX
, FLAVOR_SODX
, "Star Object Descriptor (XML)", false },
134 { PBTYPE_DUMMY_INTERNAL
, FLAVOR_DUMMY_INTERNAL
, "internal data",false }
137 #define SIZE_FLAVOR_MAP (sizeof(flavorMap)/sizeof(FlavorMap))
139 bool isByteSequenceType(const Type
& theType
)
141 return (theType
== cppu::UnoType
<Sequence
<sal_Int8
>>::get());
144 bool isOUStringType(const Type
& theType
)
146 return (theType
== cppu::UnoType
<OUString
>::get() );
149 } // unnamed namespace
151 /* A base class for other data provider.
153 class DataProviderBaseImpl
: public DataProvider
156 DataProviderBaseImpl(const Any
& data
);
157 DataProviderBaseImpl(id data
);
158 virtual ~DataProviderBaseImpl() override
;
162 //NSData* mSystemData;
166 DataProviderBaseImpl::DataProviderBaseImpl(const Any
& data
) :
172 DataProviderBaseImpl::DataProviderBaseImpl(id data
) :
175 [mSystemData retain
];
178 DataProviderBaseImpl::~DataProviderBaseImpl()
182 [mSystemData release
];
186 class UniDataProvider
: public DataProviderBaseImpl
189 UniDataProvider(const Any
& data
);
191 UniDataProvider(NSData
* data
);
193 virtual NSData
* getSystemData() override
;
195 virtual Any
getOOoData() override
;
198 UniDataProvider::UniDataProvider(const Any
& data
) :
199 DataProviderBaseImpl(data
)
203 UniDataProvider::UniDataProvider(NSData
* data
) :
204 DataProviderBaseImpl(data
)
208 NSData
* UniDataProvider::getSystemData()
214 ustr
.convertToString(&strUtf8
, RTL_TEXTENCODING_UTF8
, OUSTRING_TO_OSTRING_CVTFLAGS
);
216 return [NSData dataWithBytes
: strUtf8
.getStr() length
: strUtf8
.getLength()];
219 Any
UniDataProvider::getOOoData()
225 oOOData
<<= OUString(static_cast<const sal_Char
*>([mSystemData bytes
]),
226 [mSystemData length
],
227 RTL_TEXTENCODING_UTF8
);
237 class ByteSequenceDataProvider
: public DataProviderBaseImpl
240 ByteSequenceDataProvider(const Any
& data
);
242 ByteSequenceDataProvider(NSData
* data
);
244 virtual NSData
* getSystemData() override
;
246 virtual Any
getOOoData() override
;
249 ByteSequenceDataProvider::ByteSequenceDataProvider(const Any
& data
) :
250 DataProviderBaseImpl(data
)
254 ByteSequenceDataProvider::ByteSequenceDataProvider(NSData
* data
) :
255 DataProviderBaseImpl(data
)
259 NSData
* ByteSequenceDataProvider::getSystemData()
261 Sequence
<sal_Int8
> rawData
;
264 return [NSData dataWithBytes
: rawData
.getArray() length
: rawData
.getLength()];
267 Any
ByteSequenceDataProvider::getOOoData()
273 unsigned int flavorDataLength
= [mSystemData length
];
274 Sequence
<sal_Int8
> byteSequence
;
275 byteSequence
.realloc(flavorDataLength
);
276 memcpy(byteSequence
.getArray(), [mSystemData bytes
], flavorDataLength
);
277 oOOData
<<= byteSequence
;
287 class HTMLFormatDataProvider
: public DataProviderBaseImpl
290 HTMLFormatDataProvider(NSData
* data
);
292 virtual NSData
* getSystemData() override
;
294 virtual Any
getOOoData() override
;
297 HTMLFormatDataProvider::HTMLFormatDataProvider(NSData
* data
) :
298 DataProviderBaseImpl(data
)
302 NSData
* HTMLFormatDataProvider::getSystemData()
304 Sequence
<sal_Int8
> textHtmlData
;
305 mData
>>= textHtmlData
;
307 Sequence
<sal_Int8
> htmlFormatData
= TextHtmlToHTMLFormat(textHtmlData
);
309 return [NSData dataWithBytes
: htmlFormatData
.getArray() length
: htmlFormatData
.getLength()];
312 Any
HTMLFormatDataProvider::getOOoData()
318 unsigned int flavorDataLength
= [mSystemData length
];
319 Sequence
<sal_Int8
> unkHtmlData
;
321 unkHtmlData
.realloc(flavorDataLength
);
322 memcpy(unkHtmlData
.getArray(), [mSystemData bytes
], flavorDataLength
);
324 Sequence
<sal_Int8
>* pPlainHtml
= &unkHtmlData
;
325 Sequence
<sal_Int8
> plainHtml
;
327 if (isHTMLFormat(unkHtmlData
))
329 plainHtml
= HTMLFormatToTextHtml(unkHtmlData
);
330 pPlainHtml
= &plainHtml
;
333 oOOData
<<= *pPlainHtml
;
343 class PNGDataProvider
: public DataProviderBaseImpl
345 NSBitmapImageFileType meImageType
;
347 PNGDataProvider( const Any
&, NSBitmapImageFileType
);
349 PNGDataProvider( NSData
*, NSBitmapImageFileType
);
351 virtual NSData
* getSystemData() override
;
353 virtual Any
getOOoData() override
;
356 PNGDataProvider::PNGDataProvider( const Any
& data
, NSBitmapImageFileType eImageType
) :
357 DataProviderBaseImpl(data
),
358 meImageType( eImageType
)
362 PNGDataProvider::PNGDataProvider( NSData
* data
, NSBitmapImageFileType eImageType
) :
363 DataProviderBaseImpl(data
),
364 meImageType( eImageType
)
368 NSData
* PNGDataProvider::getSystemData()
370 Sequence
<sal_Int8
> pngData
;
373 Sequence
<sal_Int8
> imgData
;
374 NSData
* sysData
= nullptr;
375 if( PNGToImage( pngData
, imgData
, meImageType
))
376 sysData
= [NSData dataWithBytes
: imgData
.getArray() length
: imgData
.getLength()];
381 /* The AOO 'PCT' filter is not yet good enough to be used
382 and there is no flavor defined for exchanging 'PCT' with AOO
383 so we convert 'PCT' to a PNG and provide this to AOO
385 Any
PNGDataProvider::getOOoData()
391 const unsigned int flavorDataLength
= [mSystemData length
];
392 Sequence
<sal_Int8
> imgData( flavorDataLength
);
393 memcpy( imgData
.getArray(), [mSystemData bytes
], flavorDataLength
);
395 Sequence
<sal_Int8
> pngData
;
396 if( ImageToPNG( imgData
, pngData
))
407 class FileListDataProvider
: public DataProviderBaseImpl
410 FileListDataProvider(const Any
& data
);
411 FileListDataProvider(NSArray
* data
);
413 virtual NSData
* getSystemData() override
;
414 virtual Any
getOOoData() override
;
417 FileListDataProvider::FileListDataProvider(const Any
& data
) :
418 DataProviderBaseImpl(data
)
422 FileListDataProvider::FileListDataProvider(NSArray
* data
) :
423 DataProviderBaseImpl(data
)
427 NSData
* FileListDataProvider::getSystemData()
429 return [NSData data
];
432 Any
FileListDataProvider::getOOoData()
438 size_t length
= [mSystemData count
];
439 size_t lenSeqRequired
= 0;
441 for (size_t i
= 0; i
< length
; i
++)
443 NSString
* fname
= [mSystemData objectAtIndex
: i
];
444 lenSeqRequired
+= [fname maximumLengthOfBytesUsingEncoding
: NSUnicodeStringEncoding
] + sizeof(unichar
);
447 Sequence
<sal_Int8
> oOOFileList(lenSeqRequired
);
448 unichar
* pBuffer
= reinterpret_cast<unichar
*>(oOOFileList
.getArray());
449 memset(pBuffer
, 0, lenSeqRequired
);
451 for (size_t i
= 0; i
< length
; i
++)
453 NSString
* fname
= [mSystemData objectAtIndex
: i
];
454 [fname getCharacters
: pBuffer
];
455 size_t l
= [fname length
];
459 oOOData
<<= oOOFileList
;
469 DataFlavorMapper::DataFlavorMapper()
471 Reference
<XComponentContext
> xContext
= comphelper::getProcessComponentContext();
472 mrXMimeCntFactory
= MimeContentTypeFactory::create( xContext
);
475 DataFlavorMapper::~DataFlavorMapper()
477 // release potential NSStrings
478 for( OfficeOnlyTypes::iterator it
= maOfficeOnlyTypes
.begin(); it
!= maOfficeOnlyTypes
.end(); ++it
)
480 [it
->second release
];
485 DataFlavor
DataFlavorMapper::systemToOpenOfficeFlavor( const NSString
* systemDataFlavor
) const
487 DataFlavor oOOFlavor
;
489 for (size_t i
= 0; i
< SIZE_FLAVOR_MAP
; i
++)
491 if ([systemDataFlavor caseInsensitiveCompare
:const_cast<NSString
*>(flavorMap
[i
].SystemFlavor
)] == NSOrderedSame
)
493 oOOFlavor
.MimeType
= OUString::createFromAscii(flavorMap
[i
].OOoFlavor
);
494 oOOFlavor
.HumanPresentableName
= OUString::createFromAscii(flavorMap
[i
].HumanPresentableName
);
495 oOOFlavor
.DataType
= flavorMap
[i
].DataTypeOUString
? cppu::UnoType
<OUString
>::get() : cppu::UnoType
<Sequence
<sal_Int8
>>::get();
500 // look if this might be an internal type; if it comes in here it must have
501 // been through openOfficeToSystemFlavor before, so it should then be in the map
502 OUString
aTryFlavor( NSStringToOUString( systemDataFlavor
) );
503 if( maOfficeOnlyTypes
.find( aTryFlavor
) != maOfficeOnlyTypes
.end() )
505 oOOFlavor
.MimeType
= aTryFlavor
;
506 oOOFlavor
.HumanPresentableName
.clear();
507 oOOFlavor
.DataType
= cppu::UnoType
<Sequence
<sal_Int8
>>::get();
513 const NSString
* DataFlavorMapper::openOfficeToSystemFlavor( const DataFlavor
& oOOFlavor
, bool& rbInternal
) const
515 const NSString
* sysFlavor
= nullptr;
518 for( size_t i
= 0; i
< SIZE_FLAVOR_MAP
; ++i
)
520 if (oOOFlavor
.MimeType
.startsWith(OUString::createFromAscii(flavorMap
[i
].OOoFlavor
)))
522 sysFlavor
= flavorMap
[i
].SystemFlavor
;
529 OfficeOnlyTypes::const_iterator it
= maOfficeOnlyTypes
.find( oOOFlavor
.MimeType
);
531 if( it
== maOfficeOnlyTypes
.end() )
532 sysFlavor
= maOfficeOnlyTypes
[ oOOFlavor
.MimeType
] = OUStringToNSString( oOOFlavor
.MimeType
);
534 sysFlavor
= it
->second
;
540 NSString
* DataFlavorMapper::openOfficeImageToSystemFlavor(NSPasteboard
* pPasteboard
)
542 NSArray
*supportedTypes
= [NSArray arrayWithObjects
: NSPasteboardTypeTIFF
, nil
];
543 NSString
*sysFlavor
= [pPasteboard availableTypeFromArray
:supportedTypes
];
547 DataProviderPtr_t
DataFlavorMapper::getDataProvider( const NSString
* systemFlavor
, Reference
<XTransferable
> const & rTransferable
) const
549 DataProviderPtr_t dp
;
553 DataFlavor oOOFlavor
= systemToOpenOfficeFlavor(systemFlavor
);
555 Any data
= rTransferable
->getTransferData(oOOFlavor
);
557 if (isByteSequenceType(data
.getValueType()))
560 the HTMLFormatDataProvider prepends segment information to HTML
561 this is useful for exchange with MS Word (which brings this stuff from Windows)
562 but annoying for other applications. Since this extension is not a standard datatype
563 on the Mac, let us not provide but provide normal HTML
565 if ([systemFlavor caseInsensitiveCompare: NSHTMLPboardType] == NSOrderedSame)
567 dp = DataProviderPtr_t(new HTMLFormatDataProvider(data));
571 if ([systemFlavor caseInsensitiveCompare
: NSPasteboardTypeTIFF
] == NSOrderedSame
)
573 dp
= DataProviderPtr_t( new PNGDataProvider( data
, NSBitmapImageFileTypeTIFF
));
575 SAL_WNODEPRECATED_DECLARATIONS_PUSH
576 // "'NSFilenamesPboardType' is deprecated: first deprecated in macOS 10.14 - Create
577 // multiple pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead"
578 else if ([systemFlavor caseInsensitiveCompare
: NSFilenamesPboardType
] == NSOrderedSame
)
579 SAL_WNODEPRECATED_DECLARATIONS_POP
581 dp
= DataProviderPtr_t(new FileListDataProvider(data
));
585 dp
= DataProviderPtr_t(new ByteSequenceDataProvider(data
));
588 else // Must be OUString type
591 !isOUStringType(data
.getValueType()), "vcl",
592 "must be OUString type");
593 dp
= DataProviderPtr_t(new UniDataProvider(data
));
596 catch(UnsupportedFlavorException
&)
598 // Somebody violates the contract of the clipboard
599 // interface @see XTransferable
605 DataProviderPtr_t
DataFlavorMapper::getDataProvider( const NSString
* /*systemFlavor*/, NSArray
* systemData
)
607 return DataProviderPtr_t(new FileListDataProvider(systemData
));
610 DataProviderPtr_t
DataFlavorMapper::getDataProvider( const NSString
* systemFlavor
, NSData
* systemData
)
612 DataProviderPtr_t dp
;
614 if ([systemFlavor caseInsensitiveCompare
: NSPasteboardTypeString
] == NSOrderedSame
)
616 dp
= DataProviderPtr_t(new UniDataProvider(systemData
));
618 else if ([systemFlavor caseInsensitiveCompare
: NSPasteboardTypeHTML
] == NSOrderedSame
)
620 dp
= DataProviderPtr_t(new HTMLFormatDataProvider(systemData
));
622 else if ([systemFlavor caseInsensitiveCompare
: NSPasteboardTypeTIFF
] == NSOrderedSame
)
624 dp
= DataProviderPtr_t( new PNGDataProvider(systemData
, NSBitmapImageFileTypeTIFF
));
626 SAL_WNODEPRECATED_DECLARATIONS_PUSH
627 // "'NSFilenamesPboardType' is deprecated: first deprecated in macOS 10.14 - Create multiple
628 // pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead"
629 else if ([systemFlavor caseInsensitiveCompare
: NSFilenamesPboardType
] == NSOrderedSame
)
630 SAL_WNODEPRECATED_DECLARATIONS_POP
632 //dp = DataProviderPtr_t(new FileListDataProvider(systemData));
636 dp
= DataProviderPtr_t(new ByteSequenceDataProvider(systemData
));
642 bool DataFlavorMapper::isValidMimeContentType(const OUString
& contentType
) const
648 Reference
<XMimeContentType
> xCntType(mrXMimeCntFactory
->createMimeContentType(contentType
));
650 catch( IllegalArgumentException
& )
658 NSArray
* DataFlavorMapper::flavorSequenceToTypesArray(const css::uno::Sequence
<css::datatransfer::DataFlavor
>& flavors
) const
660 sal_uInt32 nFlavors
= flavors
.getLength();
661 NSMutableArray
* array
= [[NSMutableArray alloc
] initWithCapacity
: 1];
663 bool bNeedDummyInternalFlavor(false);
665 for (sal_uInt32 i
= 0; i
< nFlavors
; i
++)
667 if( flavors
[i
].MimeType
.startsWith("image/bmp") )
669 [array addObject
: NSPasteboardTypeTIFF
];
673 const NSString
* str
= openOfficeToSystemFlavor(flavors
[i
], bNeedDummyInternalFlavor
);
678 [array addObject
: str
];
684 // in case no system flavor was found to report
685 // report at least one so D&D between OOo targets works
686 if( [array count
] == 0 || bNeedDummyInternalFlavor
)
688 [array addObject
: PBTYPE_DUMMY_INTERNAL
];
691 return [array autorelease
];
694 css::uno::Sequence
<css::datatransfer::DataFlavor
> DataFlavorMapper::typesArrayToFlavorSequence(NSArray
* types
) const
696 int nFormats
= [types count
];
697 Sequence
<DataFlavor
> flavors
;
699 for (int i
= 0; i
< nFormats
; i
++)
701 NSString
* sysFormat
= [types objectAtIndex
: i
];
702 DataFlavor oOOFlavor
= systemToOpenOfficeFlavor(sysFormat
);
704 if (isValidFlavor(oOOFlavor
))
706 flavors
.realloc(flavors
.getLength() + 1);
707 flavors
[flavors
.getLength() - 1] = oOOFlavor
;
714 NSArray
* DataFlavorMapper::getAllSupportedPboardTypes()
716 NSMutableArray
* array
= [[NSMutableArray alloc
] initWithCapacity
: SIZE_FLAVOR_MAP
];
718 for (sal_uInt32 i
= 0; i
< SIZE_FLAVOR_MAP
; i
++)
720 [array addObject
: flavorMap
[i
].SystemFlavor
];
723 return [array autorelease
];
726 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */