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: char.cxx,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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_idl.hxx"
34 /****************** I N C L U D E S **************************************/
38 #ifndef _TABLE_HXX //autogen
39 #include <tools/table.hxx>
44 /****************** D A T E N ********************************************/
45 static unsigned char EqualTab
[ 256 ] = {
46 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
47 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
48 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
49 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
50 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
51 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
52 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
53 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
54 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
55 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
56 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
57 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
58 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
59 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
60 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
61 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
62 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
63 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
64 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
65 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
66 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
67 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
68 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
69 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
70 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
71 250, 251, 252, 253, 254, 255 };
74 /*************************************************************************
76 |* RscChar::GetTable()
79 |* Ersterstellung MM 08.08.91
80 |* Letzte Aenderung MM 08.08.91
82 *************************************************************************/
83 Table
* pCharTable
= NULL
;
84 unsigned char * pChange
= EqualTab
;
85 char * SvChar::GetTable( CharSet nSource
, CharSet nDest
)
87 if( nSource
== nDest
)
88 return (char *)EqualTab
;
91 pCharTable
= new Table();
94 pSet
= (BYTE
*)pCharTable
->Get( ((ULONG
)nSource
<< 16) + (ULONG
)nDest
);
98 pSet
= new BYTE
[ 256 ];
99 memcpy( pSet
, EqualTab
, sizeof( EqualTab
) );
100 for( USHORT i
= 128; i
< 256; i
++ )
102 char c
= ByteString::Convert( pSet
[i
], nSource
, nDest
);
106 pCharTable
->Insert( ((ULONG
)nSource
<< 16) + (ULONG
)nDest
, pSet
);