1*184e05d2SAndrew Rist/**************************************************************
2*184e05d2SAndrew Rist *
3*184e05d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*184e05d2SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*184e05d2SAndrew Rist * distributed with this work for additional information
6*184e05d2SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*184e05d2SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*184e05d2SAndrew Rist * "License"); you may not use this file except in compliance
9*184e05d2SAndrew Rist * with the License.  You may obtain a copy of the License at
10*184e05d2SAndrew Rist *
11*184e05d2SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*184e05d2SAndrew Rist *
13*184e05d2SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*184e05d2SAndrew Rist * software distributed under the License is distributed on an
15*184e05d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*184e05d2SAndrew Rist * KIND, either express or implied.  See the License for the
17*184e05d2SAndrew Rist * specific language governing permissions and limitations
18*184e05d2SAndrew Rist * under the License.
19*184e05d2SAndrew Rist *
20*184e05d2SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir// ============================================================================
23cdf0e10cSrcweir
24cdf0e10cSrcweirconst sal_Int32 TOKEN_MASK      = static_cast< sal_Int32 >( (1 << NMSP_SHIFT) - 1 );
25cdf0e10cSrcweirconst sal_Int32 NMSP_MASK       = static_cast< sal_Int32 >( SAL_MAX_INT16 & ~TOKEN_MASK );
26cdf0e10cSrcweir
27cdf0e10cSrcweir/** Returns the raw token identifier without namespace of the passed token. */
28cdf0e10cSrcweirinline sal_Int32 getBaseToken( sal_Int32 nToken ) { return nToken & TOKEN_MASK; }
29cdf0e10cSrcweir
30cdf0e10cSrcweir/** Returns the namespace without token identifier of the passed token. */
31cdf0e10cSrcweirinline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir// defines for tokens with specific namespaces
35cdf0e10cSrcweir#define OOX_TOKEN( namespace, token ) (::oox::NMSP_##namespace | ::oox::XML_##token)
36cdf0e10cSrcweir
37cdf0e10cSrcweir#define A_TOKEN( token )        OOX_TOKEN( dml, token )
38cdf0e10cSrcweir#define AX_TOKEN( token )       OOX_TOKEN( ax, token )
39cdf0e10cSrcweir#define C_TOKEN( token )        OOX_TOKEN( dmlChart, token )
40cdf0e10cSrcweir#define CDR_TOKEN( token )      OOX_TOKEN( dmlChartDr, token )
41cdf0e10cSrcweir#define DGM_TOKEN( token )      OOX_TOKEN( dmlDiagram, token )
42cdf0e10cSrcweir#define O_TOKEN( token )        OOX_TOKEN( vmlOffice, token )
43cdf0e10cSrcweir#define PC_TOKEN( token )       OOX_TOKEN( packageContentTypes, token )
44cdf0e10cSrcweir#define PPT_TOKEN( token )      OOX_TOKEN( ppt, token )
45cdf0e10cSrcweir#define PR_TOKEN( token )       OOX_TOKEN( packageRel, token )
46cdf0e10cSrcweir#define R_TOKEN( token )        OOX_TOKEN( officeRel, token )
47cdf0e10cSrcweir#define VML_TOKEN( token )      OOX_TOKEN( vml, token )
48cdf0e10cSrcweir#define VMLX_TOKEN( token )     OOX_TOKEN( vmlExcel, token )
49cdf0e10cSrcweir#define XDR_TOKEN( token )      OOX_TOKEN( dmlSpreadDr, token )
50cdf0e10cSrcweir#define XLS_TOKEN( token )      OOX_TOKEN( xls, token )
51cdf0e10cSrcweir#define XM_TOKEN( token )       OOX_TOKEN( xm, token )
52cdf0e10cSrcweir#define XML_TOKEN( token )      OOX_TOKEN( xml, token )
53cdf0e10cSrcweir
54cdf0e10cSrcweir// ============================================================================
55cdf0e10cSrcweir
56cdf0e10cSrcweir} // namespace oox
57cdf0e10cSrcweir
58cdf0e10cSrcweir#endif
59