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
24const sal_Int32 TOKEN_MASK      = static_cast< sal_Int32 >( (1 << NMSP_SHIFT) - 1 );
25const sal_Int32 NMSP_MASK       = static_cast< sal_Int32 >( SAL_MAX_INT16 & ~TOKEN_MASK );
26
27/** Returns the raw token identifier without namespace of the passed token. */
28inline sal_Int32 getBaseToken( sal_Int32 nToken ) { return nToken & TOKEN_MASK; }
29
30/** Returns the namespace without token identifier of the passed token. */
31inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
32
33
34// defines for tokens with specific namespaces
35#define OOX_TOKEN( namespace, token ) (::oox::NMSP_##namespace | ::oox::XML_##token)
36
37#define A_TOKEN( token )        OOX_TOKEN( dml, token )
38#define AX_TOKEN( token )       OOX_TOKEN( ax, token )
39#define C_TOKEN( token )        OOX_TOKEN( dmlChart, token )
40#define CDR_TOKEN( token )      OOX_TOKEN( dmlChartDr, token )
41#define DGM_TOKEN( token )      OOX_TOKEN( dmlDiagram, token )
42#define O_TOKEN( token )        OOX_TOKEN( vmlOffice, token )
43#define PC_TOKEN( token )       OOX_TOKEN( packageContentTypes, token )
44#define PPT_TOKEN( token )      OOX_TOKEN( ppt, token )
45#define PR_TOKEN( token )       OOX_TOKEN( packageRel, token )
46#define R_TOKEN( token )        OOX_TOKEN( officeRel, token )
47#define VML_TOKEN( token )      OOX_TOKEN( vml, token )
48#define VMLX_TOKEN( token )     OOX_TOKEN( vmlExcel, token )
49#define XDR_TOKEN( token )      OOX_TOKEN( dmlSpreadDr, token )
50#define XLS_TOKEN( token )      OOX_TOKEN( xls, token )
51#define XM_TOKEN( token )       OOX_TOKEN( xm, token )
52#define XML_TOKEN( token )      OOX_TOKEN( xml, token )
53
54// ============================================================================
55
56} // namespace oox
57
58#endif
59