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: convert.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 ************************************************************************/
34 #define _SWAPSHORT(x) ((((x) & 0xFF00)>>8) | (((x) & 0x00FF)<<8))
35 #define _SWAPLONG(x) ((((x) & 0xFF000000)>>24) | (((x) & 0x00FF0000)>>8) | \
36 (((x) & 0x0000FF00)<<8) | (((x) & 0x000000FF)<<24))
41 static void Swap( long & nValue
)
42 { nValue
= SWAPLONG( nValue
); }
43 static void Swap( ULONG
& nValue
)
44 { nValue
= SWAPLONG( nValue
); }
45 static void Swap( short & nValue
)
46 { nValue
= SWAPSHORT( nValue
); }
47 static void Swap( USHORT
& nValue
)
48 { nValue
= SWAPSHORT( nValue
); }
49 static void Swap( Point
& aPtr
)
50 { Swap( aPtr
.X() ); Swap( aPtr
.Y() ); }
51 static void Swap( Size
& aSize
)
52 { Swap( aSize
.Width() ); Swap( aSize
.Height() ); }
53 static void Swap( Rectangle
& rRect
)
54 { Swap( rRect
.Top() ); Swap( rRect
.Bottom() );
55 Swap( rRect
.Left() ); Swap( rRect
.Right() ); }
57 static USHORT AnsiFloatSize() const { return 6; }
58 static float AnsiToFloat( void * pAnsiFloat )
60 static USHORT AnsiDoubleSize() const { return 12; }
61 static double AnsiToDouble( void * pAnsiDouble )
66 #endif // _CONVERT_HXX