xref: /trunk/main/oox/inc/oox/export/utils.hxx (revision e3508121)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _OOX_EXPORT_UTILS_HXX_
25 #define _OOX_EXPORT_UTILS_HXX_
26 
27 #define S(x) String( RTL_CONSTASCII_USTRINGPARAM( x ) )
28 #define US(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ))
29 #define I32S(x) OString::valueOf( (sal_Int32) x ).getStr()
30 #define I64S(x) OString::valueOf( (sal_Int64) x ).getStr()
31 #define H32S(x) OString::valueOf( (sal_Int32) x, 16 ).getStr()
32 #define H64S(x) OString::valueOf( (sal_Int64) x, 16 ).getStr()
33 #define IS(x) OString::valueOf( x ).getStr()
34 #define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
35 #define ST(x) ByteString( x, RTL_TEXTENCODING_UTF8 ).GetBuffer()
36 
37 #ifndef DBG
38 #  if OSL_DEBUG_LEVEL > 0
39 #    define DBG(x) x
40 #  else
41 #    define DBG(x)
42 #  endif
43 #endif
44 
45 // ---------------------------------------------------------------------------------------------
46 
PPTtoEMU(INT32 nPPT)47 static inline sal_Int64 PPTtoEMU( INT32 nPPT )
48 {
49     return (sal_Int64)( (double)nPPT * 1587.5 );
50 }
51 
52 // ---------------------------------------------------------------------------------------------
53 
MM100toEMU(INT32 nMM100)54 static inline sal_Int64 MM100toEMU( INT32 nMM100 )
55 {
56     return (sal_Int64)nMM100 * 360;
57 }
58 
59 // ---------------------------------------------------------------------------------------------
60 
TwipsToEMU(sal_Int32 nTwips)61 static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips )
62 {
63     return sal_Int64( nTwips ) * 635;
64 }
65 
66 #endif
67