xref: /trunk/main/dtrans/source/win32/dtobj/DOTransferable.hxx (revision 52ec01ac05bde4ba6193689bce5c5f172e6b5f3d)
1fbcf0fe9SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3fbcf0fe9SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4fbcf0fe9SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5fbcf0fe9SAndrew Rist  * distributed with this work for additional information
6fbcf0fe9SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7fbcf0fe9SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8fbcf0fe9SAndrew Rist  * "License"); you may not use this file except in compliance
9fbcf0fe9SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11fbcf0fe9SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13fbcf0fe9SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14fbcf0fe9SAndrew Rist  * software distributed under the License is distributed on an
15fbcf0fe9SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16fbcf0fe9SAndrew Rist  * KIND, either express or implied.  See the License for the
17fbcf0fe9SAndrew Rist  * specific language governing permissions and limitations
18fbcf0fe9SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20fbcf0fe9SAndrew Rist  *************************************************************/
21fbcf0fe9SAndrew Rist 
22fbcf0fe9SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DOTRANSFERABLE_HXX_
25cdf0e10cSrcweir #define _DOTRANSFERABLE_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //------------------------------------------------------------------------
28cdf0e10cSrcweir // includes
29cdf0e10cSrcweir //------------------------------------------------------------------------
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <com/sun/star/datatransfer/XTransferable.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE1_HXX_
34cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include "DataFmtTransl.hxx"
37cdf0e10cSrcweir #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
38cdf0e10cSrcweir #include <com/sun/star/datatransfer/XMimeContentType.hpp>
39cdf0e10cSrcweir #include <com/sun/star/datatransfer/XSystemTransferable.hpp>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <systools/win32/comtools.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //------------------------------------------------------------------------
44*52ec01acSmseidel // declarations
45cdf0e10cSrcweir //------------------------------------------------------------------------
46cdf0e10cSrcweir 
47cdf0e10cSrcweir // forward
48cdf0e10cSrcweir class CDTransObjFactory;
49cdf0e10cSrcweir class CFormatEtc;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir class CDOTransferable : public ::cppu::WeakImplHelper2< ::com::sun::star::datatransfer::XTransferable,
52cdf0e10cSrcweir                         ::com::sun::star::datatransfer::XSystemTransferable>
53cdf0e10cSrcweir {
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir     typedef com::sun::star::uno::Sequence< sal_Int8 > ByteSequence_t;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     //------------------------------------------------------------------------
58cdf0e10cSrcweir     // XTransferable
59cdf0e10cSrcweir     //------------------------------------------------------------------------
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
62cdf0e10cSrcweir         throw( ::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors(  )
65cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
68cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
69cdf0e10cSrcweir     //------------------------------------------------------------------------
70cdf0e10cSrcweir     // XSystemTransferable
71cdf0e10cSrcweir     //------------------------------------------------------------------------
72cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getData( const com::sun::star::uno::Sequence<sal_Int8>& aProcessId  ) throw
73cdf0e10cSrcweir     (::com::sun::star::uno::RuntimeException);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 
76cdf0e10cSrcweir private:
77cdf0e10cSrcweir     // should be created only by CDTransObjFactory
78cdf0e10cSrcweir     explicit CDOTransferable(
79cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager,
80cdf0e10cSrcweir         IDataObjectPtr rDataObject );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     //------------------------------------------------------------------------
83cdf0e10cSrcweir     // some helper functions
84cdf0e10cSrcweir     //------------------------------------------------------------------------
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     void SAL_CALL initFlavorList( );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     void SAL_CALL addSupportedFlavor( const com::sun::star::datatransfer::DataFlavor& aFlavor );
89cdf0e10cSrcweir     com::sun::star::datatransfer::DataFlavor SAL_CALL formatEtcToDataFlavor( const FORMATETC& aFormatEtc );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     ByteSequence_t SAL_CALL getClipboardData( CFormatEtc& aFormatEtc );
92cdf0e10cSrcweir     rtl::OUString  SAL_CALL synthesizeUnicodeText( );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     void SAL_CALL clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     ::com::sun::star::uno::Any SAL_CALL byteStreamToAny( ByteSequence_t& aByteStream, const com::sun::star::uno::Type& aRequestedDataType );
97cdf0e10cSrcweir     rtl::OUString              SAL_CALL byteStreamToOUString( ByteSequence_t& aByteStream );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     LCID SAL_CALL getLocaleFromClipboard( );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     sal_Bool SAL_CALL compareDataFlavors( const com::sun::star::datatransfer::DataFlavor& lhs,
102cdf0e10cSrcweir                                           const com::sun::star::datatransfer::DataFlavor& rhs );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     sal_Bool SAL_CALL cmpFullMediaType( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xLhs,
105cdf0e10cSrcweir                                         const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xRhs ) const;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     sal_Bool SAL_CALL cmpAllContentTypeParameter( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xLhs,
108cdf0e10cSrcweir                                         const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xRhs ) const;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir private:
111cdf0e10cSrcweir     IDataObjectPtr                                                                          m_rDataObject;
112cdf0e10cSrcweir     com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor >               m_FlavorList;
113cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >  m_SrvMgr;
114cdf0e10cSrcweir     CDataFormatTranslator                                                                   m_DataFormatTranslator;
115cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentTypeFactory > m_rXMimeCntFactory;
116cdf0e10cSrcweir     ::osl::Mutex                                                                            m_aMutex;
117cdf0e10cSrcweir     sal_Bool                                                                                m_bUnicodeRegistered;
118cdf0e10cSrcweir     CLIPFORMAT                                                                              m_TxtFormatOnClipboard;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir // non supported operations
121cdf0e10cSrcweir private:
122cdf0e10cSrcweir     CDOTransferable( const CDOTransferable& );
123cdf0e10cSrcweir     CDOTransferable& operator=( const CDOTransferable& );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     friend class CDTransObjFactory;
126cdf0e10cSrcweir };
127cdf0e10cSrcweir 
128cdf0e10cSrcweir #endif
129