1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salcvt.hxx,v $
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 ************************************************************************/
30 #ifndef SAL_CONVERTER_CACHE_HXX_
31 #define SAL_CONVERTER_CACHE_HXX_
34 #include <rtl/tencinfo.h>
35 #include <rtl/textcvt.h>
39 extern "C" const char*
40 pGetEncodingName( rtl_TextEncoding nEncoding
);
43 // Cache TextToUnicode and UnicodeToText converter and conversion info which is
44 // used in DrawXYZ routines and in the Event loop
47 class SalConverterCache
{
53 rtl_TextEncoding nEncoding
, sal_Unicode nChar
);
54 rtl_UnicodeToTextConverter
55 GetU2TConverter( rtl_TextEncoding nEncoding
);
56 rtl_TextToUnicodeConverter
57 GetT2UConverter( rtl_TextEncoding nEncoding
);
58 Bool
IsSingleByteEncoding( rtl_TextEncoding nEncoding
);
59 sal_Size
ConvertStringUTF16( const sal_Unicode
*pText
, int nTextLen
,
60 sal_Char
*pBuffer
, sal_Size nBufferSize
,
61 rtl_TextEncoding nEncoding
);
63 static SalConverterCache
*
69 rtl_UnicodeToTextConverter mpU2T
;
70 rtl_TextToUnicodeConverter mpT2U
;
71 Bool mbSingleByteEncoding
;
76 mbSingleByteEncoding( False
),
83 rtl_destroyUnicodeToTextConverter( mpU2T
);
85 rtl_destroyTextToUnicodeConverter( mpT2U
);
89 std::map
< rtl_TextEncoding
, ConverterT
> m_aConverters
;
94 #endif /* SAL_CONVERTER_CACHE_HXX_ */