LibreOffice Module dtrans (master)  1
DOTransferable.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_DOTRANSFERABLE_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_DOTRANSFERABLE_HXX
22 
23 #include <com/sun/star/datatransfer/XTransferable.hpp>
24 
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>
30 
31 #include <systools/win32/comtools.hxx>
32 
33 // forward
34 class CFormatEtc;
35 
36 class CDOTransferable : public ::cppu::WeakImplHelper<
37  css::datatransfer::XTransferable,
38  css::datatransfer::XSystemTransferable>
39 {
40 public:
41  typedef css::uno::Sequence< sal_Int8 > ByteSequence_t;
42 
43  static css::uno::Reference< css::datatransfer::XTransferable > create(
44  const css::uno::Reference< css::uno::XComponentContext >& rxContext, IDataObjectPtr pIDataObject );
45 
46  // XTransferable
47 
48  virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) override;
49 
50  virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) override;
51 
52  virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) override;
53 
54  // XSystemTransferable
55 
56  virtual css::uno::Any SAL_CALL getData( const css::uno::Sequence<sal_Int8>& aProcessId ) override;
57 
58 private:
59  explicit CDOTransferable(
60  const css::uno::Reference< css::uno::XComponentContext >& rxContext,
61  IDataObjectPtr rDataObject );
62 
63  // some helper functions
64 
65  void initFlavorList( );
66 
67  void addSupportedFlavor( const css::datatransfer::DataFlavor& aFlavor );
68  css::datatransfer::DataFlavor formatEtcToDataFlavor( const FORMATETC& aFormatEtc );
69 
70  ByteSequence_t getClipboardData( CFormatEtc& aFormatEtc );
71  OUString synthesizeUnicodeText( );
72 
73  LCID getLocaleFromClipboard( );
74 
75  bool compareDataFlavors( const css::datatransfer::DataFlavor& lhs,
76  const css::datatransfer::DataFlavor& rhs );
77 
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;
83  css::uno::Reference< css::datatransfer::XMimeContentTypeFactory > m_rXMimeCntFactory;
84  ::osl::Mutex m_aMutex;
87 
88 // non supported operations
89 private:
92 };
93 
94 #endif
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::osl::Mutex m_aMutex
virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override
ByteSequence_t getClipboardData(CFormatEtc &aFormatEtc)
css::datatransfer::DataFlavor formatEtcToDataFlavor(const FORMATETC &aFormatEtc)
css::uno::Sequence< css::datatransfer::DataFlavor > m_FlavorList
virtual css::uno::Any SAL_CALL getData(const css::uno::Sequence< sal_Int8 > &aProcessId) override
OUString synthesizeUnicodeText()
CDOTransferable & operator=(const CDOTransferable &)
css::uno::Sequence< sal_Int8 > ByteSequence_t
css::uno::Reference< css::datatransfer::XMimeContentTypeFactory > m_rXMimeCntFactory
CDOTransferable(const css::uno::Reference< css::uno::XComponentContext > &rxContext, IDataObjectPtr rDataObject)
virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor &aFlavor) override
const css::uno::Reference< css::uno::XComponentContext > m_xContext
static css::uno::Reference< css::datatransfer::XTransferable > create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, IDataObjectPtr pIDataObject)
unsigned char sal_Bool
CDataFormatTranslator m_DataFormatTranslator
virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor &aFlavor) override
bool compareDataFlavors(const css::datatransfer::DataFlavor &lhs, const css::datatransfer::DataFlavor &rhs)
IDataObjectPtr m_rDataObject
void addSupportedFlavor(const css::datatransfer::DataFlavor &aFlavor)
LCID getLocaleFromClipboard()
CLIPFORMAT m_TxtFormatOnClipboard