diff options
author | Rüdiger Timm <rt@openoffice.org> | 2007-07-05 08:10:32 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2007-07-05 08:10:32 +0000 |
commit | dfbf23d53097b33f700110ec8c2bf4d502c7d14c (patch) | |
tree | 75595de1f12657fa371d665e08e5b44db7f97752 /dtrans | |
parent | 7cf2922573819e439c00fd80648a824291ab6c91 (diff) |
INTEGRATION: CWS aquavcl01 (1.1.2); FILE ADDED
2007/06/14 12:06:18 tra 1.1.2.2: Work in progress, checked in to have it saved in the repos.
2007/05/24 19:53:30 tra 1.1.2.1: Implementing paste system -> OOo
Diffstat (limited to 'dtrans')
-rw-r--r-- | dtrans/source/aqua/OSXTransferable.hxx | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/dtrans/source/aqua/OSXTransferable.hxx b/dtrans/source/aqua/OSXTransferable.hxx new file mode 100644 index 000000000000..8417482410b9 --- /dev/null +++ b/dtrans/source/aqua/OSXTransferable.hxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OSXTransferable.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2007-07-05 09:10:32 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + + +#ifndef _TRANSFERABLE_HXX_ +#define _TRANSFERABLE_HXX_ + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ + +#ifndef _COM_SUN_STAR_DATATRANSFER_XTRANSFERABLE_HPP_ +#include <com/sun/star/datatransfer/XTransferable.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +#ifndef _COM_SUN_STAR_DATATRANSFER_XMIMECONTENTTYPEFACTORY_HPP_ +#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_DATATRANSFER_XMIMECONTENTTYPE_HPP_ +#include <com/sun/star/datatransfer/XMimeContentType.hpp> +#endif + +#include "DataFlavorMapping.hxx" + +#include <premac.h> + #include <Carbon/Carbon.h> + #include <ApplicationServices/ApplicationServices.h> +#include <postmac.h> + +#include <boost/shared_ptr.hpp> +#include <vector> + +struct ClipboardItem +{ + ClipboardItem(PasteboardItemID id, + CFStringRef systemFlavor, + const com::sun::star::datatransfer::DataFlavor& oOOFlavor); + + ~ClipboardItem(); + + PasteboardItemID mId; + CFStringRef mSystemDataFlavor; + com::sun::star::datatransfer::DataFlavor mOOoDataFlavor; +}; + +typedef boost::shared_ptr<ClipboardItem> ClipboardItemPtr_t; +typedef std::vector<ClipboardItemPtr_t> ClipboardItemContainer_t; + + +class OSXTransferable : public ::cppu::WeakImplHelper1<com::sun::star::datatransfer::XTransferable> +{ +public: + typedef com::sun::star::uno::Sequence< sal_Int8 > ByteSequence_t; + + explicit OSXTransferable(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > ServiceManager, + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory, + DataFlavorMapperPtr_t pDataFlavorMapper); + + virtual ~OSXTransferable(); + + //------------------------------------------------------------------------ + // XTransferable + //------------------------------------------------------------------------ + + virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) + throw( ::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) + throw( ::com::sun::star::uno::RuntimeException ); + + void addClipboardItemFlavors(PasteboardItemID clipboardItemId); + + ClipboardItemPtr_t findMatchingClipboardItem(const com::sun::star::datatransfer::DataFlavor& aFlavor); + + void initClipboardItemList(); + + com::sun::star::uno::Any getClipboardItemData(ClipboardItemPtr_t clipboardItem); + + bool isUnicodeText(ClipboardItemPtr_t clipboardItem); + + bool compareDataFlavors( const com::sun::star::datatransfer::DataFlavor& lhs, + const com::sun::star::datatransfer::DataFlavor& rhs ); + + + bool cmpAllContentTypeParameter( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xLhs, + const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xRhs ) const; + + +private: + ClipboardItemContainer_t mClipboardItems; + com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > m_FlavorList; + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mrSrvMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory; + DataFlavorMapperPtr_t mpDataFlavorMapper; + osl::Mutex m_aMutex; + PasteboardRef mrClipboard; + + // prevent copy and assignment +private: + OSXTransferable( const OSXTransferable& ); + OSXTransferable& operator=( const OSXTransferable& ); +}; + +#endif |