Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / dtrans / source / win32 / dtobj / DOTransferable.hxx
blobf45e18c4f85a09e704e2f1d0c6d2dc9c19c5276e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/implbase.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>
33 // forward
34 class CFormatEtc;
36 class CDOTransferable : public ::cppu::WeakImplHelper<
37 css::datatransfer::XTransferable,
38 css::datatransfer::XSystemTransferable>
40 public:
41 typedef css::uno::Sequence< sal_Int8 > ByteSequence_t;
43 static css::uno::Reference< css::datatransfer::XTransferable > create(
44 const css::uno::Reference< css::uno::XComponentContext >& rxContext, IDataObjectPtr pIDataObject );
46 // XTransferable
48 virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) override;
50 virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) override;
52 virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) override;
54 // XSystemTransferable
56 virtual css::uno::Any SAL_CALL getData( const css::uno::Sequence<sal_Int8>& aProcessId ) override;
58 private:
59 explicit CDOTransferable(
60 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
61 IDataObjectPtr rDataObject );
63 // some helper functions
65 void initFlavorList( );
67 void addSupportedFlavor( const css::datatransfer::DataFlavor& aFlavor );
68 css::datatransfer::DataFlavor formatEtcToDataFlavor( const FORMATETC& aFormatEtc );
70 ByteSequence_t getClipboardData( CFormatEtc& aFormatEtc );
71 OUString synthesizeUnicodeText( );
73 LCID getLocaleFromClipboard( );
75 bool compareDataFlavors( const css::datatransfer::DataFlavor& lhs,
76 const css::datatransfer::DataFlavor& rhs );
78 private:
79 IDataObjectPtr m_rDataObject;
80 css::uno::Sequence< css::datatransfer::DataFlavor > m_FlavorList;
81 const css::uno::Reference< css::uno::XComponentContext > m_xContext;
82 CDataFormatTranslator m_DataFormatTranslator;
83 css::uno::Reference< css::datatransfer::XMimeContentTypeFactory > m_rXMimeCntFactory;
84 ::osl::Mutex m_aMutex;
85 bool m_bUnicodeRegistered;
86 CLIPFORMAT m_TxtFormatOnClipboard;
88 // non supported operations
89 private:
90 CDOTransferable( const CDOTransferable& );
91 CDOTransferable& operator=( const CDOTransferable& );
94 #endif
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */