Update ooo320-m1
[ooovba.git] / dtrans / source / win32 / ftransl / ftransl.hxx
blob4b1da8eaed2c573327dd789fd0429df23beb9aba
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ftransl.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _FTRANSL_HXX_
33 #define _FTRANSL_HXX_
35 //------------------------------------------------------------------------
36 // includes
37 //------------------------------------------------------------------------
39 #include <rtl/ustring.hxx>
40 #include <sal/types.h>
41 #include <cppuhelper/compbase2.hxx>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/datatransfer/XDataFormatTranslator.hpp>
44 #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
45 #include "..\misc\WinClip.hxx"
47 #include <vector>
49 #if defined _MSC_VER
50 #pragma warning(push,1)
51 #endif
52 #include <windows.h>
53 #if defined _MSC_VER
54 #pragma warning(pop)
55 #endif
57 //------------------------------------------------------------------------
58 // declarations
59 //------------------------------------------------------------------------
61 struct FormatEntry
63 FormatEntry();
65 FormatEntry(
66 const char* mime_content_type,
67 const char* human_presentable_name,
68 const char* native_format_name,
69 CLIPFORMAT std_clipboard_format_id,
70 com::sun::star::uno::Type const & cppu_type
73 com::sun::star::datatransfer::DataFlavor aDataFlavor;
74 rtl::OUString aNativeFormatName;
75 sal_Int32 aStandardFormatId;
78 //------------------------------------------------
79 // CDataFormatTranslator
80 //------------------------------------------------
82 class CDataFormatTranslator : public
83 cppu::WeakImplHelper2< com::sun::star::datatransfer::XDataFormatTranslator, \
84 com::sun::star::lang::XServiceInfo >
87 public:
88 CDataFormatTranslator( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr );
90 //------------------------------------------------
91 // XDataFormatTranslator
92 //------------------------------------------------
94 virtual ::com::sun::star::uno::Any SAL_CALL getSystemDataTypeFromDataFlavor( const ::com::sun::star::datatransfer::DataFlavor& aDataFlavor )
95 throw(::com::sun::star::uno::RuntimeException);
97 virtual ::com::sun::star::datatransfer::DataFlavor SAL_CALL getDataFlavorFromSystemDataType( const ::com::sun::star::uno::Any& aSysDataType )
98 throw(::com::sun::star::uno::RuntimeException);
100 //------------------------------------------------
101 // XServiceInfo
102 //------------------------------------------------
104 virtual ::rtl::OUString SAL_CALL getImplementationName( )
105 throw(::com::sun::star::uno::RuntimeException);
107 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
108 throw(::com::sun::star::uno::RuntimeException);
110 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
111 throw(::com::sun::star::uno::RuntimeException);
113 private:
114 void SAL_CALL initTranslationTable( );
116 void SAL_CALL findDataFlavorForStandardFormatId( sal_Int32 aStandardFormatId, com::sun::star::datatransfer::DataFlavor& aDataFlavor ) const;
117 void SAL_CALL findDataFlavorForNativeFormatName( const rtl::OUString& aNativeFormatName, com::sun::star::datatransfer::DataFlavor& aDataFlavor ) const;
118 void SAL_CALL findStandardFormatIdForCharset( const rtl::OUString& aCharset, com::sun::star::uno::Any& aAny ) const;
119 void SAL_CALL setStandardFormatIdForNativeFormatName( const rtl::OUString& aNativeFormatName, com::sun::star::uno::Any& aAny ) const;
120 void SAL_CALL findStdFormatIdOrNativeFormatNameForFullMediaType(
121 const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentTypeFactory >& aRefXMimeFactory,
122 const rtl::OUString& aFullMediaType, com::sun::star::uno::Any& aAny ) const;
124 sal_Bool isTextPlainMediaType( const rtl::OUString& fullMediaType ) const;
126 com::sun::star::datatransfer::DataFlavor SAL_CALL mkDataFlv( const rtl::OUString& cnttype, const rtl::OUString& hpname, ::com::sun::star::uno::Type dtype );
128 private:
129 std::vector< FormatEntry > m_TranslTable;
130 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr;
134 #endif