1184e05d2SAndrew Rist/************************************************************** 2184e05d2SAndrew Rist * 3184e05d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4184e05d2SAndrew Rist * or more contributor license agreements. See the NOTICE file 5184e05d2SAndrew Rist * distributed with this work for additional information 6184e05d2SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7184e05d2SAndrew Rist * to you under the Apache License, Version 2.0 (the 8184e05d2SAndrew Rist * "License"); you may not use this file except in compliance 9184e05d2SAndrew Rist * with the License. You may obtain a copy of the License at 10184e05d2SAndrew Rist * 11184e05d2SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12184e05d2SAndrew Rist * 13184e05d2SAndrew Rist * Unless required by applicable law or agreed to in writing, 14184e05d2SAndrew Rist * software distributed under the License is distributed on an 15184e05d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16184e05d2SAndrew Rist * KIND, either express or implied. See the License for the 17184e05d2SAndrew Rist * specific language governing permissions and limitations 18184e05d2SAndrew Rist * under the License. 19184e05d2SAndrew Rist * 20184e05d2SAndrew 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 ) 42*4e7b0f82SDamjan Jovanovic#define ENCRYPTION_TOKEN( token) OOX_TOKEN( encryption, token ) 43*4e7b0f82SDamjan Jovanovic#define KEY_ENCRYPTOR_PASSWORD_TOKEN( token ) OOX_TOKEN( keyEncryptorPassword, token ) 44cdf0e10cSrcweir#define O_TOKEN( token ) OOX_TOKEN( vmlOffice, token ) 45cdf0e10cSrcweir#define PC_TOKEN( token ) OOX_TOKEN( packageContentTypes, token ) 46cdf0e10cSrcweir#define PPT_TOKEN( token ) OOX_TOKEN( ppt, token ) 47cdf0e10cSrcweir#define PR_TOKEN( token ) OOX_TOKEN( packageRel, token ) 48cdf0e10cSrcweir#define R_TOKEN( token ) OOX_TOKEN( officeRel, token ) 49cdf0e10cSrcweir#define VML_TOKEN( token ) OOX_TOKEN( vml, token ) 50cdf0e10cSrcweir#define VMLX_TOKEN( token ) OOX_TOKEN( vmlExcel, token ) 51cdf0e10cSrcweir#define XDR_TOKEN( token ) OOX_TOKEN( dmlSpreadDr, token ) 52cdf0e10cSrcweir#define XLS_TOKEN( token ) OOX_TOKEN( xls, token ) 53cdf0e10cSrcweir#define XM_TOKEN( token ) OOX_TOKEN( xm, token ) 54cdf0e10cSrcweir#define XML_TOKEN( token ) OOX_TOKEN( xml, token ) 55cdf0e10cSrcweir 56cdf0e10cSrcweir// ============================================================================ 57cdf0e10cSrcweir 58cdf0e10cSrcweir} // namespace oox 59cdf0e10cSrcweir 60cdf0e10cSrcweir#endif 61