1*0d63794cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0d63794cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0d63794cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0d63794cSAndrew Rist * distributed with this work for additional information 6*0d63794cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0d63794cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0d63794cSAndrew Rist * "License"); you may not use this file except in compliance 9*0d63794cSAndrew Rist * with the License. You may obtain a copy of the License at 10*0d63794cSAndrew Rist * 11*0d63794cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*0d63794cSAndrew Rist * 13*0d63794cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0d63794cSAndrew Rist * software distributed under the License is distributed on an 15*0d63794cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0d63794cSAndrew Rist * KIND, either express or implied. See the License for the 17*0d63794cSAndrew Rist * specific language governing permissions and limitations 18*0d63794cSAndrew Rist * under the License. 19*0d63794cSAndrew Rist * 20*0d63794cSAndrew Rist *************************************************************/ 21*0d63794cSAndrew Rist 22*0d63794cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir 25cdf0e10cSrcweir #ifndef _TRANSFERABLE_HXX_ 26cdf0e10cSrcweir #define _TRANSFERABLE_HXX_ 27cdf0e10cSrcweir 28cdf0e10cSrcweir //------------------------------------------------------------------------ 29cdf0e10cSrcweir // includes 30cdf0e10cSrcweir //------------------------------------------------------------------------ 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <com/sun/star/datatransfer/XTransferable.hpp> 33cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 34cdf0e10cSrcweir #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp> 35cdf0e10cSrcweir #include <com/sun/star/datatransfer/XMimeContentType.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include "DataFlavorMapping.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <premac.h> 40cdf0e10cSrcweir #import <Cocoa/Cocoa.h> 41cdf0e10cSrcweir #include <postmac.h> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 44cdf0e10cSrcweir #include <boost/utility.hpp> 45cdf0e10cSrcweir #include <vector> 46cdf0e10cSrcweir 47cdf0e10cSrcweir 48cdf0e10cSrcweir class OSXTransferable : public ::cppu::WeakImplHelper1<com::sun::star::datatransfer::XTransferable>, 49cdf0e10cSrcweir private ::boost::noncopyable 50cdf0e10cSrcweir { 51cdf0e10cSrcweir public: 52cdf0e10cSrcweir typedef com::sun::star::uno::Sequence< sal_Int8 > ByteSequence_t; 53cdf0e10cSrcweir 54cdf0e10cSrcweir explicit OSXTransferable(com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory, 55cdf0e10cSrcweir DataFlavorMapperPtr_t pDataFlavorMapper, 56cdf0e10cSrcweir NSPasteboard* pasteboard); 57cdf0e10cSrcweir 58cdf0e10cSrcweir virtual ~OSXTransferable(); 59cdf0e10cSrcweir 60cdf0e10cSrcweir //------------------------------------------------------------------------ 61cdf0e10cSrcweir // XTransferable 62cdf0e10cSrcweir //------------------------------------------------------------------------ 63cdf0e10cSrcweir 64cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) 65cdf0e10cSrcweir throw( ::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException ); 66cdf0e10cSrcweir 67cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) 68cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 69cdf0e10cSrcweir 70cdf0e10cSrcweir virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) 71cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 72cdf0e10cSrcweir 73cdf0e10cSrcweir //------------------------------------------------------------------------ 74cdf0e10cSrcweir // Helper functions not part of the XTransferable interface 75cdf0e10cSrcweir //------------------------------------------------------------------------ 76cdf0e10cSrcweir 77cdf0e10cSrcweir void initClipboardItemList(); 78cdf0e10cSrcweir 79cdf0e10cSrcweir //com::sun::star::uno::Any getClipboardItemData(ClipboardItemPtr_t clipboardItem); 80cdf0e10cSrcweir 81cdf0e10cSrcweir bool isUnicodeText(const com::sun::star::datatransfer::DataFlavor& flavor); 82cdf0e10cSrcweir 83cdf0e10cSrcweir bool compareDataFlavors( const com::sun::star::datatransfer::DataFlavor& lhs, 84cdf0e10cSrcweir const com::sun::star::datatransfer::DataFlavor& rhs ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir bool cmpAllContentTypeParameter( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xLhs, 87cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xRhs ) const; 88cdf0e10cSrcweir 89cdf0e10cSrcweir private: 90cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > mFlavorList; 91cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory; 92cdf0e10cSrcweir DataFlavorMapperPtr_t mDataFlavorMapper; 93cdf0e10cSrcweir NSPasteboard* mPasteboard; 94cdf0e10cSrcweir }; 95cdf0e10cSrcweir 96cdf0e10cSrcweir #endif 97