Branch libreoffice-5-0-4
[LibreOffice.git] / dtrans / source / win32 / ftransl / ftransl.hxx
blob6bf5ec2dd18ba03419ec845bdfd78e6a62c47d10
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_FTRANSL_FTRANSL_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_FTRANSL_FTRANSL_HXX
23 #include <rtl/ustring.hxx>
24 #include <sal/types.h>
25 #include <cppuhelper/compbase2.hxx>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/datatransfer/XDataFormatTranslator.hpp>
28 #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include "../misc/WinClip.hxx"
32 #include <vector>
34 #if defined _MSC_VER
35 #pragma warning(push,1)
36 #endif
37 #include <windows.h>
38 #if defined _MSC_VER
39 #pragma warning(pop)
40 #endif
42 struct FormatEntry
44 FormatEntry();
46 FormatEntry(
47 const char* mime_content_type,
48 const char* human_presentable_name,
49 const char* native_format_name,
50 CLIPFORMAT std_clipboard_format_id,
51 com::sun::star::uno::Type const & cppu_type
54 com::sun::star::datatransfer::DataFlavor aDataFlavor;
55 OUString aNativeFormatName;
56 sal_Int32 aStandardFormatId;
59 // CDataFormatTranslator
61 class CDataFormatTranslator : public
62 cppu::WeakImplHelper2< com::sun::star::datatransfer::XDataFormatTranslator, \
63 com::sun::star::lang::XServiceInfo >
66 public:
67 CDataFormatTranslator( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
69 // XDataFormatTranslator
71 virtual ::com::sun::star::uno::Any SAL_CALL getSystemDataTypeFromDataFlavor( const ::com::sun::star::datatransfer::DataFlavor& aDataFlavor )
72 throw(::com::sun::star::uno::RuntimeException);
74 virtual ::com::sun::star::datatransfer::DataFlavor SAL_CALL getDataFlavorFromSystemDataType( const ::com::sun::star::uno::Any& aSysDataType )
75 throw(::com::sun::star::uno::RuntimeException);
77 // XServiceInfo
79 virtual OUString SAL_CALL getImplementationName( )
80 throw(::com::sun::star::uno::RuntimeException);
82 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
83 throw(::com::sun::star::uno::RuntimeException);
85 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
86 throw(::com::sun::star::uno::RuntimeException);
88 private:
89 void SAL_CALL initTranslationTable( );
91 void SAL_CALL findDataFlavorForStandardFormatId( sal_Int32 aStandardFormatId, com::sun::star::datatransfer::DataFlavor& aDataFlavor ) const;
92 void SAL_CALL findDataFlavorForNativeFormatName( const OUString& aNativeFormatName, com::sun::star::datatransfer::DataFlavor& aDataFlavor ) const;
93 void SAL_CALL findStandardFormatIdForCharset( const OUString& aCharset, com::sun::star::uno::Any& aAny ) const;
94 void SAL_CALL setStandardFormatIdForNativeFormatName( const OUString& aNativeFormatName, com::sun::star::uno::Any& aAny ) const;
95 void SAL_CALL findStdFormatIdOrNativeFormatNameForFullMediaType(
96 const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentTypeFactory >& aRefXMimeFactory,
97 const OUString& aFullMediaType, com::sun::star::uno::Any& aAny ) const;
99 sal_Bool isTextPlainMediaType( const OUString& fullMediaType ) const;
101 com::sun::star::datatransfer::DataFlavor SAL_CALL mkDataFlv( const OUString& cnttype, const OUString& hpname, ::com::sun::star::uno::Type dtype );
103 private:
104 std::vector< FormatEntry > m_TranslTable;
105 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
108 #endif
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */