Branch data Line data Source code
1 : : /*
2 : : * This file is part of the LibreOffice project.
3 : : *
4 : : * This Source Code Form is subject to the terms of the Mozilla Public
5 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : : *
8 : : * This file incorporates work covered by the following license notice:
9 : : *
10 : : * Licensed to the Apache Software Foundation (ASF) under one or more
11 : : * contributor license agreements. See the NOTICE file distributed
12 : : * with this work for additional information regarding copyright
13 : : * ownership. The ASF licenses this file to you under the Apache
14 : : * License, Version 2.0 (the "License"); you may not use this file
15 : : * except in compliance with the License. You may obtain a copy of
16 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 : : */
18 : :
19 : : #ifndef OOX_TOKEN_NAMESPACES_HXX
20 : : #define OOX_TOKEN_NAMESPACES_HXX
21 : :
22 : : #include <sal/types.h>
23 : :
24 : : namespace oox {
25 : :
26 : : // ============================================================================
27 : :
28 : : const size_t NMSP_SHIFT = 16;
29 : : const sal_Int32 NMSP_vmlExcel = 1 << NMSP_SHIFT;
30 : : const sal_Int32 NMSP_mce = 2 << NMSP_SHIFT;
31 : : const sal_Int32 NMSP_ax = 3 << NMSP_SHIFT;
32 : : const sal_Int32 NMSP_schema = 4 << NMSP_SHIFT;
33 : : const sal_Int32 NMSP_officeDocPropsVT = 5 << NMSP_SHIFT;
34 : : const sal_Int32 NMSP_packageRel = 6 << NMSP_SHIFT;
35 : : const sal_Int32 NMSP_vmlOffice = 7 << NMSP_SHIFT;
36 : : const sal_Int32 NMSP_xml = 8 << NMSP_SHIFT;
37 : : const sal_Int32 NMSP_doc = 9 << NMSP_SHIFT;
38 : : const sal_Int32 NMSP_dmlSpreadDr = 10 << NMSP_SHIFT;
39 : : const sal_Int32 NMSP_dc = 11 << NMSP_SHIFT;
40 : : const sal_Int32 NMSP_officeCustomPr = 12 << NMSP_SHIFT;
41 : : const sal_Int32 NMSP_xlsExtLst = 13 << NMSP_SHIFT;
42 : : const sal_Int32 NMSP_packageMetaCorePr = 14 << NMSP_SHIFT;
43 : : const sal_Int32 NMSP_vmlPowerpoint = 15 << NMSP_SHIFT;
44 : : const sal_Int32 NMSP_dmlChartDr = 16 << NMSP_SHIFT;
45 : : const sal_Int32 NMSP_officeRelTheme = 17 << NMSP_SHIFT;
46 : : const sal_Int32 NMSP_officeMath = 18 << NMSP_SHIFT;
47 : : const sal_Int32 NMSP_dmlPicture = 19 << NMSP_SHIFT;
48 : : const sal_Int32 NMSP_officeRel = 20 << NMSP_SHIFT;
49 : : const sal_Int32 NMSP_dcTerms = 21 << NMSP_SHIFT;
50 : : const sal_Int32 NMSP_sprm = 22 << NMSP_SHIFT;
51 : : const sal_Int32 NMSP_officeExtPr = 23 << NMSP_SHIFT;
52 : : const sal_Int32 NMSP_vml = 24 << NMSP_SHIFT;
53 : : const sal_Int32 NMSP_dsp = 25 << NMSP_SHIFT;
54 : : const sal_Int32 NMSP_dmlWordDr = 26 << NMSP_SHIFT;
55 : : const sal_Int32 NMSP_xls = 27 << NMSP_SHIFT;
56 : : const sal_Int32 NMSP_dmlDiagram = 28 << NMSP_SHIFT;
57 : : const sal_Int32 NMSP_packageContentTypes = 29 << NMSP_SHIFT;
58 : : const sal_Int32 NMSP_xm = 30 << NMSP_SHIFT;
59 : : const sal_Int32 NMSP_mceTest = 31 << NMSP_SHIFT;
60 : : const sal_Int32 NMSP_dmlChart = 32 << NMSP_SHIFT;
61 : : const sal_Int32 NMSP_ppt = 33 << NMSP_SHIFT;
62 : : const sal_Int32 NMSP_vmlWord = 34 << NMSP_SHIFT;
63 : : const sal_Int32 NMSP_dml = 35 << NMSP_SHIFT;
64 : : /*
65 : : * This file is part of the LibreOffice project.
66 : : *
67 : : * This Source Code Form is subject to the terms of the Mozilla Public
68 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
69 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
70 : : *
71 : : * This file incorporates work covered by the following license notice:
72 : : *
73 : : * Licensed to the Apache Software Foundation (ASF) under one or more
74 : : * contributor license agreements. See the NOTICE file distributed
75 : : * with this work for additional information regarding copyright
76 : : * ownership. The ASF licenses this file to you under the Apache
77 : : * License, Version 2.0 (the "License"); you may not use this file
78 : : * except in compliance with the License. You may obtain a copy of
79 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
80 : : */
81 : :
82 : : // ============================================================================
83 : :
84 : : const sal_Int32 TOKEN_MASK = static_cast< sal_Int32 >( (1 << NMSP_SHIFT) - 1 );
85 : : const sal_Int32 NMSP_MASK = static_cast< sal_Int32 >( SAL_MAX_INT32 & ~TOKEN_MASK );
86 : :
87 : : /** Returns the raw token identifier without namespace of the passed token. */
88 : 1545 : inline sal_Int32 getBaseToken( sal_Int32 nToken ) { return nToken & TOKEN_MASK; }
89 : :
90 : : /** Returns the namespace without token identifier of the passed token. */
91 : 12529 : inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
92 : :
93 : :
94 : : // defines for tokens with specific namespaces
95 : : #define OOX_TOKEN( namespace, token ) (::oox::NMSP_##namespace | ::oox::XML_##token)
96 : :
97 : : #define A_TOKEN( token ) OOX_TOKEN( dml, token )
98 : : #define AX_TOKEN( token ) OOX_TOKEN( ax, token )
99 : : #define C_TOKEN( token ) OOX_TOKEN( dmlChart, token )
100 : : #define CDR_TOKEN( token ) OOX_TOKEN( dmlChartDr, token )
101 : : #define DGM_TOKEN( token ) OOX_TOKEN( dmlDiagram, token )
102 : : #define MCE_TOKEN( token ) OOX_TOKEN( mce, token)
103 : : #define O_TOKEN( token ) OOX_TOKEN( vmlOffice, token )
104 : : #define PC_TOKEN( token ) OOX_TOKEN( packageContentTypes, token )
105 : : #define PPT_TOKEN( token ) OOX_TOKEN( ppt, token )
106 : : #define PR_TOKEN( token ) OOX_TOKEN( packageRel, token )
107 : : #define R_TOKEN( token ) OOX_TOKEN( officeRel, token )
108 : : #define VML_TOKEN( token ) OOX_TOKEN( vml, token )
109 : : #define VMLX_TOKEN( token ) OOX_TOKEN( vmlExcel, token )
110 : : #define XDR_TOKEN( token ) OOX_TOKEN( dmlSpreadDr, token )
111 : : #define XLS_TOKEN( token ) OOX_TOKEN( xls, token )
112 : : #define XLS_EXT_TOKEN( token ) OOX_TOKEN( xlsExtLst, token )
113 : : #define XM_TOKEN( token ) OOX_TOKEN( xm, token )
114 : : #define XML_TOKEN( token ) OOX_TOKEN( xml, token )
115 : : #define VMLPPT_TOKEN( token ) OOX_TOKEN( vmlPowerpoint, token )
116 : : #define DSP_TOKEN( token ) OOX_TOKEN( dsp, token )
117 : :
118 : : // ============================================================================
119 : :
120 : : } // namespace oox
121 : :
122 : : #endif
|