[Libreoffice-commits] core.git: Branch 'aoo/trunk' - vcl/aqua

Armin Le Grand alg at apache.org
Thu Jun 6 07:07:32 PDT 2013


 vcl/aqua/source/dtrans/DataFlavorMapping.cxx |   30 +++++++++++----------------
 vcl/aqua/source/dtrans/DataFlavorMapping.hxx |    4 ---
 vcl/aqua/source/dtrans/OSXTransferable.cxx   |    3 +-
 vcl/aqua/source/dtrans/aqua_clipboard.cxx    |    3 +-
 4 files changed, 18 insertions(+), 22 deletions(-)

New commits:
commit 11d6690fddcebec67baba285f87e647241ebfd82
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Jun 6 12:10:35 2013 +0000

    i122420 Re-activated the internal OpenOfficeToSystemFlavor

diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
index 1669e5a..c784602 100644
--- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
+++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
@@ -549,9 +549,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 )
     {
@@ -561,17 +562,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;
 }
@@ -697,7 +697,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++)
   {
@@ -708,11 +708,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)
           {
diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
index 296d8f0..9a9e709 100644
--- a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
+++ b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
@@ -85,7 +85,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
@@ -132,8 +132,6 @@ 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;
diff --git a/vcl/aqua/source/dtrans/OSXTransferable.cxx b/vcl/aqua/source/dtrans/OSXTransferable.cxx
index 21aadd5..9a12689 100644
--- a/vcl/aqua/source/dtrans/OSXTransferable.cxx
+++ b/vcl/aqua/source/dtrans/OSXTransferable.cxx
@@ -84,10 +84,11 @@ Any SAL_CALL OSXTransferable::getTransferData( const DataFlavor& aFlavor )
                                        static_cast<XTransferable*>(this));
     }
 
+  bool bInternal(false);
   NSString* sysFormat =
       (aFlavor.MimeType.compareToAscii( "image/png", 9 ) == 0)
       ? mDataFlavorMapper->openOfficeImageToSystemFlavor( mPasteboard )
-      : mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor);
+      : mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor, bInternal);
   DataProviderPtr_t dp;
 
   if ([sysFormat caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame)
diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
index a764d06..d2d6f3b 100644
--- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx
+++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
@@ -343,10 +343,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)
             {


More information about the Libreoffice-commits mailing list