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