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