bump product version to 7.6.3.2-android
[LibreOffice.git] / vcl / win / dtrans / DOTransferable.hxx
blob1824c7b44844c464faf82245154c9d981871fb74
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 #pragma once
22 #include <com/sun/star/datatransfer/XTransferable.hpp>
24 #include <cppuhelper/implbase.hxx>
25 #include "DataFmtTransl.hxx"
26 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
27 #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
28 #include <com/sun/star/datatransfer/XMimeContentType.hpp>
29 #include <com/sun/star/datatransfer/XSystemTransferable.hpp>
30 #include <cppuhelper/weakref.hxx>
32 #include <systools/win32/comtools.hxx>
34 #include <mutex>
35 #include <vector>
37 // forward
38 class CFormatEtc;
40 class CDOTransferable : public ::cppu::WeakImplHelper<
41 css::datatransfer::XTransferable>
43 public:
44 typedef css::uno::Sequence< sal_Int8 > ByteSequence_t;
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 explicit CDOTransferable(
55 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
56 const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard,
57 const std::vector<sal_uInt32>& rFormats);
59 explicit CDOTransferable(
60 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
61 IDataObjectPtr rDataObject );
63 private:
64 // some helper functions
66 void initFlavorList( );
67 void initFlavorListFromFormatList(const std::vector<sal_uInt32>& rFormats);
69 void addSupportedFlavor( const css::datatransfer::DataFlavor& aFlavor );
70 css::datatransfer::DataFlavor formatEtcToDataFlavor(sal_uInt32 cfFormat);
72 void tryToGetIDataObjectIfAbsent();
73 ByteSequence_t getClipboardData( CFormatEtc& aFormatEtc );
74 OUString synthesizeUnicodeText( );
76 LCID getLocaleFromClipboard( );
78 bool compareDataFlavors( const css::datatransfer::DataFlavor& lhs,
79 const css::datatransfer::DataFlavor& rhs );
81 private:
82 css::uno::WeakReference<css::datatransfer::clipboard::XClipboard> m_xClipboard;
83 IDataObjectPtr m_rDataObject;
84 css::uno::Sequence< css::datatransfer::DataFlavor > m_FlavorList;
85 const css::uno::Reference< css::uno::XComponentContext > m_xContext;
86 CDataFormatTranslator m_DataFormatTranslator;
87 css::uno::Reference< css::datatransfer::XMimeContentTypeFactory > m_rXMimeCntFactory;
88 std::mutex m_aMutex;
89 bool m_bUnicodeRegistered;
90 CLIPFORMAT m_TxtFormatOnClipboard;
92 // non supported operations
93 private:
94 CDOTransferable( const CDOTransferable& );
95 CDOTransferable& operator=( const CDOTransferable& );
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */