[Libreoffice-commits] core.git: vcl/aqua
Andre Fischer
af at apache.org
Fri May 24 06:59:02 PDT 2013
vcl/aqua/source/dtrans/DataFlavorMapping.cxx | 27 ++++++++++++++++++---------
vcl/aqua/source/dtrans/DataFlavorMapping.hxx | 2 ++
2 files changed, 20 insertions(+), 9 deletions(-)
New commits:
commit e31d408ca6bdaaa3eef9fc2eaa50e4745ebd33ff
Author: Andre Fischer <af at apache.org>
Date: Wed Aug 22 07:37:16 2012 +0000
Resolves: #i120481# Add registered transferable flavor...
to make the Writer accept column headers dragged from database tables.
(cherry picked from commit a32aabba57b53f581691f60e5484a6ddf3deb9f2)
Change-Id: I63d41c8000cdfc7f0b2ca28e83aaedf2e822e64d
diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
index 7b57871..d61d09b 100644
--- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
+++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
@@ -564,14 +564,17 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor
}
}
- if( ! sysFlavor )
- {
- OfficeOnlyTypes::const_iterator it = maOfficeOnlyTypes.find( oOOFlavor.MimeType );
- if( it == maOfficeOnlyTypes.end() )
- sysFlavor = maOfficeOnlyTypes[ oOOFlavor.MimeType ] = OUStringToNSString( oOOFlavor.MimeType );
- else
- sysFlavor = it->second;
- }
+ return sysFlavor;
+}
+
+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;
return sysFlavor;
}
@@ -699,6 +702,8 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno:
sal_uInt32 nFlavors = flavors.getLength();
NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity: 1];
+ bool bNeedDummyInternalFlavor (true);
+
for (sal_uInt32 i = 0; i < nFlavors; i++)
{
if( flavors[i].MimeType.startsWith("image/bmp") )
@@ -709,6 +714,10 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno:
else
{
NSString* str = openOfficeToSystemFlavor(flavors[i]);
+ if (str == NULL)
+ str = internalOpenOfficeToSystemFlavor(flavors[i]);
+ else
+ bNeedDummyInternalFlavor = false;
if (str != NULL)
{
@@ -721,7 +730,7 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno:
// #i89462# #i90747#
// in case no system flavor was found to report
// report at least one so D&D between OOo targets works
- if( [array count] == 0 )
+ if( [array count] == 0 || bNeedDummyInternalFlavor)
{
[array addObject: PBTYPE_DUMMY_INTERNAL];
}
diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
index ed78689..3c1ee87 100644
--- a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
+++ b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
@@ -128,6 +128,8 @@ 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;
More information about the Libreoffice-commits
mailing list