incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1375940 - in /incubator/ooo/trunk/main/vcl/aqua/source/dtrans: DataFlavorMapping.cxx DataFlavorMapping.hxx
Date Wed, 22 Aug 2012 08:37:16 GMT
Author: af
Date: Wed Aug 22 08:37:16 2012
New Revision: 1375940

URL: http://svn.apache.org/viewvc?rev=1375940&view=rev
Log:
#i120481# Add registered transferable flavor to make the Writer accept
          column headers dragged from database tables.

Modified:
    incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
    incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx

Modified: incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx?rev=1375940&r1=1375939&r2=1375940&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx (original)
+++ incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx Wed Aug 22 08:37:16
2012
@@ -568,17 +568,20 @@ NSString* DataFlavorMapper::openOfficeTo
 		    sysFlavor = flavorMap[i].SystemFlavor;
 		}
 	}
+
+        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;
 	
-	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;
+    return sysFlavor;
 }
 
 NSString* DataFlavorMapper::openOfficeImageToSystemFlavor(NSPasteboard* pPasteboard) const
@@ -702,6 +705,8 @@ NSArray* DataFlavorMapper::flavorSequenc
   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.compareToAscii( "image/bmp", 9 ) == 0 )
@@ -712,6 +717,10 @@ NSArray* DataFlavorMapper::flavorSequenc
       else
       {
           NSString* str = openOfficeToSystemFlavor(flavors[i]);
+          if (str == NULL)
+              str = internalOpenOfficeToSystemFlavor(flavors[i]);
+          else
+              bNeedDummyInternalFlavor = false;
           
           if (str != NULL)
           {
@@ -724,7 +733,7 @@ NSArray* DataFlavorMapper::flavorSequenc
    // #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];
   }

Modified: incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx?rev=1375940&r1=1375939&r2=1375940&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx (original)
+++ incubator/ooo/trunk/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx Wed Aug 22 08:37:16
2012
@@ -132,6 +132,8 @@ private:
    */
   bool isValidMimeContentType(const rtl::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 std::hash_map< rtl::OUString, NSString*, rtl::OUStringHash > OfficeOnlyTypes;



Mime
View raw message