update dev300-m58
[ooovba.git] / dtrans / source / aqua / OSXTransferable.hxx
blobdcf02ab285ce8b025c9ab236505db0f61d152314
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OSXTransferable.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _TRANSFERABLE_HXX_
33 #define _TRANSFERABLE_HXX_
35 //------------------------------------------------------------------------
36 // includes
37 //------------------------------------------------------------------------
39 #include <com/sun/star/datatransfer/XTransferable.hpp>
40 #include <cppuhelper/implbase1.hxx>
41 #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
42 #include <com/sun/star/datatransfer/XMimeContentType.hpp>
44 #include "DataFlavorMapping.hxx"
46 #include <premac.h>
47 #import <Cocoa/Cocoa.h>
48 #include <postmac.h>
50 #include <boost/shared_ptr.hpp>
51 #include <boost/utility.hpp>
52 #include <vector>
55 class OSXTransferable : public ::cppu::WeakImplHelper1<com::sun::star::datatransfer::XTransferable>,
56 private ::boost::noncopyable
58 public:
59 typedef com::sun::star::uno::Sequence< sal_Int8 > ByteSequence_t;
61 explicit OSXTransferable(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context,
62 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory,
63 DataFlavorMapperPtr_t pDataFlavorMapper,
64 NSPasteboard* pasteboard);
66 virtual ~OSXTransferable();
68 //------------------------------------------------------------------------
69 // XTransferable
70 //------------------------------------------------------------------------
72 virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
73 throw( ::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
75 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( )
76 throw( ::com::sun::star::uno::RuntimeException );
78 virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
79 throw( ::com::sun::star::uno::RuntimeException );
81 //------------------------------------------------------------------------
82 // Helper functions not part of the XTransferable interface
83 //------------------------------------------------------------------------
85 void initClipboardItemList();
87 //com::sun::star::uno::Any getClipboardItemData(ClipboardItemPtr_t clipboardItem);
89 bool isUnicodeText(const com::sun::star::datatransfer::DataFlavor& flavor);
91 bool compareDataFlavors( const com::sun::star::datatransfer::DataFlavor& lhs,
92 const com::sun::star::datatransfer::DataFlavor& rhs );
94 bool cmpAllContentTypeParameter( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xLhs,
95 const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xRhs ) const;
97 private:
98 com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > mFlavorList;
99 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mXComponentContext;
100 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory;
101 DataFlavorMapperPtr_t mDataFlavorMapper;
102 NSPasteboard* mPasteboard;
105 #endif