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

Resolves: #i122420# Re-activated the internal OpenOfficeToSystemFlavor

(cherry picked from commit 11d6690f)

Change-Id: I23c71470e587f8ece54aa9f2991634211ff3b4b5
üst 5aee0c13
......@@ -544,9 +544,10 @@ DataFlavor DataFlavorMapper::systemToOpenOfficeFlavor(NSString* systemDataFlavor
return oOOFlavor;
}
NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor) const
NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor, bool& rbInternal) const
{
NSString* sysFlavor = NULL;
rbInternal = false;
for( size_t i = 0; i < SIZE_FLAVOR_MAP; ++i )
{
......@@ -556,17 +557,16 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor
}
}
return sysFlavor;
}
if(!sysFlavor)
{
rbInternal = true;
OfficeOnlyTypes::const_iterator it = maOfficeOnlyTypes.find( oOOFlavor.MimeType );
NSString* DataFlavorMapper::internalOpenOfficeToSystemFlavor(const DataFlavor& oOOFlavor) const
{
NSString* sysFlavor = NULL;
OfficeOnlyTypes::const_iterator it = maOfficeOnlyTypes.find( oOOFlavor.MimeType );
if( it == maOfficeOnlyTypes.end() )
sysFlavor = maOfficeOnlyTypes[ oOOFlavor.MimeType ] = OUStringToNSString( oOOFlavor.MimeType );
else
sysFlavor = it->second;
if( it == maOfficeOnlyTypes.end() )
sysFlavor = maOfficeOnlyTypes[ oOOFlavor.MimeType ] = OUStringToNSString( oOOFlavor.MimeType );
else
sysFlavor = it->second;
}
return sysFlavor;
}
......@@ -694,7 +694,7 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno:
sal_uInt32 nFlavors = flavors.getLength();
NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity: 1];
bool bNeedDummyInternalFlavor (true);
bool bNeedDummyInternalFlavor(false);
for (sal_uInt32 i = 0; i < nFlavors; i++)
{
......@@ -705,11 +705,7 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno:
}
else
{
NSString* str = openOfficeToSystemFlavor(flavors[i]);
if (str == NULL)
str = internalOpenOfficeToSystemFlavor(flavors[i]);
else
bNeedDummyInternalFlavor = false;
NSString* str = openOfficeToSystemFlavor(flavors[i], bNeedDummyInternalFlavor);
if (str != NULL)
{
......
......@@ -81,7 +81,7 @@ public:
If there is no suiteable mapping available NULL will
be returned.
*/
NSString* openOfficeToSystemFlavor(const com::sun::star::datatransfer::DataFlavor& oooDataFlavor) const;
NSString* openOfficeToSystemFlavor(const com::sun::star::datatransfer::DataFlavor& oooDataFlavor, bool& rbInternal) const;
/* Select the best available image data type
If there is no suiteable mapping available NULL will
......@@ -128,8 +128,6 @@ private:
*/
bool isValidMimeContentType(const OUString& contentType) const;
NSString* internalOpenOfficeToSystemFlavor(const com::sun::star::datatransfer::DataFlavor& oooDataFlavor) const;
private:
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory;
typedef boost::unordered_map< OUString, NSString*, OUStringHash > OfficeOnlyTypes;
......
......@@ -73,10 +73,11 @@ Any SAL_CALL OSXTransferable::getTransferData( const DataFlavor& aFlavor )
static_cast<XTransferable*>(this));
}
bool bInternal(false);
NSString* sysFormat =
(aFlavor.MimeType.startsWith("image/png"))
? mDataFlavorMapper->openOfficeImageToSystemFlavor( mPasteboard )
: mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor);
: mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor, bInternal);
DataProviderPtr_t dp;
if ([sysFormat caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame)
......
......@@ -326,10 +326,11 @@ void SAL_CALL AquaClipboard::flushClipboard()
{
Sequence<DataFlavor> flavorList = mXClipboardContent->getTransferDataFlavors();
sal_uInt32 nFlavors = flavorList.getLength();
bool bInternal(false);
for (sal_uInt32 i = 0; i < nFlavors; i++)
{
NSString* sysType = mpDataFlavorMapper->openOfficeToSystemFlavor(flavorList[i]);
NSString* sysType = mpDataFlavorMapper->openOfficeToSystemFlavor(flavorList[i], bInternal);
if (sysType != NULL)
{
......
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