1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_DOTRANSFERABLE_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_DOTRANSFERABLE_HXX
23 #include <com/sun/star/datatransfer/XTransferable.hpp>
25 #include <cppuhelper/implbase2.hxx>
26 #include "DataFmtTransl.hxx"
27 #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
28 #include <com/sun/star/datatransfer/XMimeContentType.hpp>
29 #include <com/sun/star/datatransfer/XSystemTransferable.hpp>
31 #include <systools/win32/comtools.hxx>
34 class CDTransObjFactory
;
37 class CDOTransferable
: public ::cppu::WeakImplHelper2
< ::com::sun::star::datatransfer::XTransferable
,
38 ::com::sun::star::datatransfer::XSystemTransferable
>
41 typedef com::sun::star::uno::Sequence
< sal_Int8
> ByteSequence_t
;
45 virtual ::com::sun::star::uno::Any SAL_CALL
getTransferData( const ::com::sun::star::datatransfer::DataFlavor
& aFlavor
)
46 throw( ::com::sun::star::datatransfer::UnsupportedFlavorException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
48 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::datatransfer::DataFlavor
> SAL_CALL
getTransferDataFlavors( )
49 throw( ::com::sun::star::uno::RuntimeException
);
51 virtual sal_Bool SAL_CALL
isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor
& aFlavor
)
52 throw( ::com::sun::star::uno::RuntimeException
);
54 // XSystemTransferable
56 virtual ::com::sun::star::uno::Any SAL_CALL
getData( const com::sun::star::uno::Sequence
<sal_Int8
>& aProcessId
) throw
57 (::com::sun::star::uno::RuntimeException
);
60 // should be created only by CDTransObjFactory
61 explicit CDOTransferable(
62 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
,
63 IDataObjectPtr rDataObject
);
65 // some helper functions
67 void SAL_CALL
initFlavorList( );
69 void SAL_CALL
addSupportedFlavor( const com::sun::star::datatransfer::DataFlavor
& aFlavor
);
70 com::sun::star::datatransfer::DataFlavor SAL_CALL
formatEtcToDataFlavor( const FORMATETC
& aFormatEtc
);
72 ByteSequence_t SAL_CALL
getClipboardData( CFormatEtc
& aFormatEtc
);
73 OUString SAL_CALL
synthesizeUnicodeText( );
75 void SAL_CALL
clipDataToByteStream( CLIPFORMAT cf
, STGMEDIUM stgmedium
, ByteSequence_t
& aByteSequence
);
77 ::com::sun::star::uno::Any SAL_CALL
byteStreamToAny( ByteSequence_t
& aByteStream
, const com::sun::star::uno::Type
& aRequestedDataType
);
78 OUString SAL_CALL
byteStreamToOUString( ByteSequence_t
& aByteStream
);
80 LCID SAL_CALL
getLocaleFromClipboard( );
82 sal_Bool SAL_CALL
compareDataFlavors( const com::sun::star::datatransfer::DataFlavor
& lhs
,
83 const com::sun::star::datatransfer::DataFlavor
& rhs
);
85 sal_Bool SAL_CALL
cmpFullMediaType( const com::sun::star::uno::Reference
< com::sun::star::datatransfer::XMimeContentType
>& xLhs
,
86 const com::sun::star::uno::Reference
< com::sun::star::datatransfer::XMimeContentType
>& xRhs
) const;
88 sal_Bool SAL_CALL
cmpAllContentTypeParameter( const com::sun::star::uno::Reference
< com::sun::star::datatransfer::XMimeContentType
>& xLhs
,
89 const com::sun::star::uno::Reference
< com::sun::star::datatransfer::XMimeContentType
>& xRhs
) const;
92 IDataObjectPtr m_rDataObject
;
93 com::sun::star::uno::Sequence
< com::sun::star::datatransfer::DataFlavor
> m_FlavorList
;
94 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
95 CDataFormatTranslator m_DataFormatTranslator
;
96 com::sun::star::uno::Reference
< com::sun::star::datatransfer::XMimeContentTypeFactory
> m_rXMimeCntFactory
;
97 ::osl::Mutex m_aMutex
;
98 sal_Bool m_bUnicodeRegistered
;
99 CLIPFORMAT m_TxtFormatOnClipboard
;
101 // non supported operations
103 CDOTransferable( const CDOTransferable
& );
104 CDOTransferable
& operator=( const CDOTransferable
& );
106 friend class CDTransObjFactory
;
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */