1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef _DATAFMTTRANSL_HXX_
30 #define _DATAFMTTRANSL_HXX_
31 
32 //-----------------------------------------------
33 // includes
34 //-----------------------------------------------
35 
36 #include <cppuhelper/servicefactory.hxx>
37 #include <com/sun/star/datatransfer/XDataFormatTranslator.hpp>
38 #include <com/sun/star/datatransfer/XTransferable.hpp>
39 #include <sal/types.h>
40 #include <rtl/ustring.hxx>
41 
42 #if defined _MSC_VER
43 #pragma warning(push,1)
44 #endif
45 #include <windows.h>
46 #if defined _MSC_VER
47 #pragma warning(pop)
48 #endif
49 
50 //-----------------------------------------------
51 // declaration
52 //-----------------------------------------------
53 
54 class CFormatEtc;
55 
56 class CDataFormatTranslator
57 {
58 public:
59 	CDataFormatTranslator( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&	aServiceManager );
60 
61 	CFormatEtc getFormatEtcFromDataFlavor( const com::sun::star::datatransfer::DataFlavor& aDataFlavor ) const;
62 	com::sun::star::datatransfer::DataFlavor getDataFlavorFromFormatEtc(
63 		const FORMATETC& aFormatEtc, LCID lcid = GetThreadLocale( ) ) const;
64 
65 	CFormatEtc    SAL_CALL getFormatEtcForClipformat( CLIPFORMAT cf ) const;
66 	CFormatEtc    SAL_CALL getFormatEtcForClipformatName( const rtl::OUString& aClipFmtName ) const;
67 	rtl::OUString SAL_CALL getClipboardFormatName( CLIPFORMAT aClipformat ) const;
68 
69 	sal_Bool SAL_CALL isHTMLFormat( CLIPFORMAT cf ) const;
70 	sal_Bool SAL_CALL isTextHtmlFormat( CLIPFORMAT cf ) const;
71 	sal_Bool SAL_CALL isOemOrAnsiTextFormat( CLIPFORMAT cf ) const;
72 	sal_Bool SAL_CALL isUnicodeTextFormat( CLIPFORMAT cf ) const;
73 	sal_Bool SAL_CALL isTextFormat( CLIPFORMAT cf ) const;
74 
75 private:
76 	rtl::OUString SAL_CALL getTextCharsetFromLCID( LCID lcid, CLIPFORMAT aClipformat ) const;
77 
78 private:
79 	const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >	m_SrvMgr;
80 	com::sun::star::uno::Reference< com::sun::star::datatransfer::XDataFormatTranslator >	m_XDataFormatTranslator;
81 };
82 
83 #endif
84