xref: /aoo41x/main/sc/source/filter/inc/xlconst.hxx (revision 38d50f7b)
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 SC_XLCONST_HXX
25 #define SC_XLCONST_HXX
26 
27 #include "address.hxx"
28 
29 // Common =====================================================================
30 
31 // BIFF versions --------------------------------------------------------------
32 
33 /** An enumeration for all Excel file format types (BIFF types). */
34 enum XclBiff
35 {
36     EXC_BIFF2 = 0,              /// MS Excel 2.1
37     EXC_BIFF3,                  /// MS Excel 3.0
38     EXC_BIFF4,                  /// MS Excel 4.0
39     EXC_BIFF5,                  /// MS Excel 5.0, MS Excel 7.0 (95)
40     EXC_BIFF8,                  /// MS Excel 8.0 (97), 9.0 (2000), 10.0 (XP), 11.0 (2003)
41     EXC_BIFF_UNKNOWN            /// Unknown BIFF version.
42 };
43 
44 /** An enumeration for all Excel output format types. */
45 enum XclOutput
46 {
47     EXC_OUTPUT_BINARY,          /// MS Excel binary .xls
48     EXC_OUTPUT_XML_2007,        /// MS Excel 2007 .xlsx
49 };
50 
51 // Excel sheet dimensions -----------------------------------------------------
52 
53 const SCCOL EXC_MAXCOL2                     = 255;
54 const SCROW EXC_MAXROW2                     = 16383;
55 const SCTAB EXC_MAXTAB2                     = 0;
56 
57 const SCCOL EXC_MAXCOL3                     = EXC_MAXCOL2;
58 const SCROW EXC_MAXROW3                     = EXC_MAXROW2;
59 const SCTAB EXC_MAXTAB3                     = EXC_MAXTAB2;
60 
61 const SCCOL EXC_MAXCOL4                     = EXC_MAXCOL3;
62 const SCROW EXC_MAXROW4                     = EXC_MAXROW3;
63 const SCTAB EXC_MAXTAB4                     = 32767;
64 
65 const SCCOL EXC_MAXCOL5                     = EXC_MAXCOL4;
66 const SCROW EXC_MAXROW5                     = EXC_MAXROW4;
67 const SCTAB EXC_MAXTAB5                     = EXC_MAXTAB4;
68 
69 const SCCOL EXC_MAXCOL8                     = EXC_MAXCOL5;
70 const SCROW EXC_MAXROW8                     = 65535;
71 const SCTAB EXC_MAXTAB8                     = EXC_MAXTAB5;
72 
73 const sal_uInt16 EXC_NOTAB                  = SAL_MAX_UINT16;   /// An invalid Excel sheet index, for common use.
74 const SCTAB SCTAB_INVALID                   = SCTAB_MAX;        /// An invalid Calc sheet index, for common use.
75 const SCTAB SCTAB_GLOBAL                    = SCTAB_MAX;        /// A Calc sheet index for the workbook globals.
76 
77 // Storage/stream names -------------------------------------------------------
78 
79 #define EXC_STORAGE_OLE_LINKED              CREATE_STRING( "LNK" )
80 #define EXC_STORAGE_OLE_EMBEDDED            CREATE_STRING( "MBD" )
81 #define EXC_STORAGE_VBA_PROJECT             CREATE_STRING( "_VBA_PROJECT_CUR" )
82 #define EXC_STORAGE_VBA                     CREATE_STRING( "VBA" )
83 
84 #define EXC_STREAM_BOOK                     CREATE_STRING( "Book" )
85 #define EXC_STREAM_WORKBOOK                 CREATE_STRING( "Workbook" )
86 #define EXC_STREAM_CTLS                     CREATE_STRING( "Ctls" )
87 
88 // Encoded URLs ---------------------------------------------------------------
89 
90 const sal_Unicode EXC_URLSTART_ENCODED      = '\x01';   /// Encoded URL.
91 const sal_Unicode EXC_URLSTART_SELF         = '\x02';   /// Reference to own workbook.
92 const sal_Unicode EXC_URLSTART_SELFENCODED  = '\x03';   /// Encoded self reference.
93 const sal_Unicode EXC_URLSTART_OWNDOC       = '\x04';   /// Reference to own workbook (BIFF5/BIFF7).
94 
95 const sal_Unicode EXC_URL_DOSDRIVE          = '\x01';   /// DOS drive letter or UNC server name.
96 const sal_Unicode EXC_URL_DRIVEROOT         = '\x02';   /// Root directory of current drive.
97 const sal_Unicode EXC_URL_SUBDIR            = '\x03';   /// Directory name delimiter.
98 const sal_Unicode EXC_URL_PARENTDIR         = '\x04';   /// Parent directory.
99 const sal_Unicode EXC_URL_RAW               = '\x05';   /// Unencoded URL.
100 const sal_Unicode EXC_URL_SHEETNAME         = '\x09';   /// Sheet name starts here (BIFF4).
101 
102 const sal_Unicode EXC_DDE_DELIM             = '\x03';   /// DDE application-topic delimiter
103 
104 // Error codes ----------------------------------------------------------------
105 
106 const sal_uInt8 EXC_ERR_NULL                = 0x00;
107 const sal_uInt8 EXC_ERR_DIV0                = 0x07;
108 const sal_uInt8 EXC_ERR_VALUE               = 0x0F;
109 const sal_uInt8 EXC_ERR_REF                 = 0x17;
110 const sal_uInt8 EXC_ERR_NAME                = 0x1D;
111 const sal_uInt8 EXC_ERR_NUM                 = 0x24;
112 const sal_uInt8 EXC_ERR_NA                  = 0x2A;
113 
114 // Cached values list (EXTERNNAME, ptgArray, ...) -----------------------------
115 
116 const sal_uInt8 EXC_CACHEDVAL_EMPTY         = 0x00;
117 const sal_uInt8 EXC_CACHEDVAL_DOUBLE        = 0x01;
118 const sal_uInt8 EXC_CACHEDVAL_STRING        = 0x02;
119 const sal_uInt8 EXC_CACHEDVAL_BOOL          = 0x04;
120 const sal_uInt8 EXC_CACHEDVAL_ERROR         = 0x10;
121 
122 // RK values ------------------------------------------------------------------
123 
124 const sal_Int32 EXC_RK_100FLAG              = 0x00000001;
125 const sal_Int32 EXC_RK_INTFLAG              = 0x00000002;
126 const sal_Int32 EXC_RK_VALUEMASK            = 0xFFFFFFFC;
127 
128 const sal_Int32 EXC_RK_DBL                  = 0x00000000;
129 const sal_Int32 EXC_RK_DBL100               = EXC_RK_100FLAG;
130 const sal_Int32 EXC_RK_INT                  = EXC_RK_INTFLAG;
131 const sal_Int32 EXC_RK_INT100               = EXC_RK_100FLAG | EXC_RK_INTFLAG;
132 
133 // Measures -------------------------------------------------------------------
134 
135 const sal_Int32 EXC_POINTS_PER_INCH         = 72;
136 const sal_Int32 EXC_TWIPS_PER_INCH          = EXC_POINTS_PER_INCH * 20;
137 
138 const double EXC_POINTS_PER_HMM             = static_cast< double >( EXC_POINTS_PER_INCH ) / 2540.0;
139 
140 const sal_uInt8 EXC_ORIENT_NONE             = 0;        /// Text orientation: not rotated.
141 const sal_uInt8 EXC_ORIENT_STACKED          = 1;        /// Text orientation: vertically stacked.
142 const sal_uInt8 EXC_ORIENT_90CCW            = 2;        /// Text orientation: 90 deg counterclockwise.
143 const sal_uInt8 EXC_ORIENT_90CW             = 3;        /// Text orientation: 90 deg clockwise.
144 
145 const sal_uInt8 EXC_ROT_NONE                = 0;        /// Text rotation: not rotated.
146 const sal_uInt8 EXC_ROT_90CCW               = 90;       /// Text rotation: 90 deg counterclockwise.
147 const sal_uInt8 EXC_ROT_90CW                = 180;      /// Text rotation: 90 deg clockwise.
148 const sal_uInt8 EXC_ROT_STACKED             = 255;      /// Text rotation: vertically stacked.
149 
150 // Records (ordered by lowest record ID) ======================================
151 
152 // (0x0009, 0x0209, 0x0409, 0x0809) BOF ---------------------------------------
153 
154 const sal_uInt16 EXC_ID2_BOF                = 0x0009;
155 const sal_uInt16 EXC_ID3_BOF                = 0x0209;
156 const sal_uInt16 EXC_ID4_BOF                = 0x0409;
157 const sal_uInt16 EXC_ID5_BOF                = 0x0809;
158 
159 const sal_uInt16 EXC_BOF_BIFF2              = 0x0200;
160 const sal_uInt16 EXC_BOF_BIFF3              = 0x0300;
161 const sal_uInt16 EXC_BOF_BIFF4              = 0x0400;
162 const sal_uInt16 EXC_BOF_BIFF5              = 0x0500;
163 const sal_uInt16 EXC_BOF_BIFF8              = 0x0600;
164 
165 const sal_uInt16 EXC_BOF_GLOBALS            = 0x0005;   /// BIFF5-BIFF8 workbook globals.
166 const sal_uInt16 EXC_BOF_VBMODULE           = 0x0006;   /// BIFF5-BIFF8 Visual BASIC module.
167 const sal_uInt16 EXC_BOF_SHEET              = 0x0010;   /// Regular worksheet.
168 const sal_uInt16 EXC_BOF_CHART              = 0x0020;   /// Chart sheet.
169 const sal_uInt16 EXC_BOF_MACROSHEET         = 0x0040;   /// Macro sheet.
170 const sal_uInt16 EXC_BOF_WORKSPACE          = 0x0100;   /// Workspace.
171 const sal_uInt16 EXC_BOF_UNKNOWN            = 0xFFFF;   /// Internal use only.
172 
173 // (0x000A) EOF ---------------------------------------------------------------
174 
175 const sal_uInt16 EXC_ID_EOF                 = 0x000A;
176 
177 // (0x0012) PROTECT -----------------------------------------------------------
178 
179 const sal_uInt16 EXC_ID_PROTECT             = 0x0012;
180 
181 // (0x0013) PASSWORD ----------------------------------------------------------
182 
183 const sal_uInt16 EXC_ID_PASSWORD            = 0x0013;
184 
185 // (0x0019) WINDOWPROTECT -----------------------------------------------------
186 
187 const sal_uInt16 EXC_ID_WINDOWPROTECT       = 0x0019;
188 
189 // (0x0042) CODEPAGE ----------------------------------------------------------
190 
191 const sal_uInt16 EXC_ID_CODEPAGE            = 0x0042;
192 
193 // (0x0081) WSBOOL ------------------------------------------------------------
194 
195 const sal_uInt16 EXC_ID_WSBOOL              = 0x0081;
196 
197 const sal_uInt16 EXC_WSBOOL_ROWBELOW        = 0x0040;
198 const sal_uInt16 EXC_WSBOOL_COLBELOW        = 0x0080;
199 const sal_uInt16 EXC_WSBOOL_FITTOPAGE       = 0x0100;
200 
201 const sal_uInt16 EXC_WSBOOL_DEFAULTFLAGS    = 0x04C1;
202 
203 // (0x0086) WRITEPROT ---------------------------------------------------------
204 
205 const sal_uInt16 EXC_ID_WRITEPROT           = 0x0086;
206 
207 // (0x008C) COUNTRY -----------------------------------------------------------
208 
209 const sal_uInt16 EXC_ID_COUNTRY             = 0x008C;
210 
211 // (0x009B) FILTERMODE --------------------------------------------------------
212 
213 const sal_uInt16 EXC_ID_FILTERMODE          = 0x009B;
214 
215 // (0x009C) FNGROUPCOUNT ------------------------------------------------------
216 
217 const sal_uInt16 EXC_ID_FNGROUPCOUNT        = 0x009C;
218 
219 // (0x009D) AUTOFILTERINFO ----------------------------------------------------
220 
221 const sal_uInt16 EXC_ID_AUTOFILTERINFO      = 0x009D;
222 
223 // (0x009E) AUTOFILTER --------------------------------------------------------
224 
225 const sal_uInt16 EXC_ID_AUTOFILTER          = 0x009E;
226 
227 // (0x00BF, 0x00C0, 0x00C1) TOOLBARHDR, TOOLBAREND, MMS -----------------------
228 
229 const sal_uInt16 EXC_ID_TOOLBARHDR          = 0x00BF;
230 const sal_uInt16 EXC_ID_TOOLBAREND          = 0x00C0;
231 const sal_uInt16 EXC_ID_MMS                 = 0x00C1;
232 
233 // (0x00E1, 0x00E2) INTERFACEHDR, INTERFACEEND --------------------------------
234 
235 const sal_uInt16 EXC_ID_INTERFACEHDR        = 0x00E1;
236 const sal_uInt16 EXC_ID_INTERFACEEND        = 0x00E2;
237 
238 // (0x0160) USESELFS ----------------------------------------------------------
239 
240 const sal_uInt16 EXC_ID_USESELFS            = 0x0160;
241 
242 // (0x0161) DSF ---------------------------------------------------------------
243 
244 const sal_uInt16 EXC_ID_DSF                 = 0x0161;
245 
246 // (0x01AA,0x01AB) USERSVIEWBEGIN, USERSVIEWEND -------------------------------
247 
248 const sal_uInt16 EXC_ID_USERSVIEWBEGIN      = 0x01AA;
249 const sal_uInt16 EXC_ID_USERSVIEWEND        = 0x01AB;
250 
251 // (0x01BA) CODENAME ----------------------------------------------------------
252 
253 const sal_uInt16 EXC_ID_CODENAME            = 0x01BA;
254 
255 // (0x01C0) XL9FILE -----------------------------------------------------------
256 
257 const sal_uInt16 EXC_ID_XL9FILE             = 0x01C0;
258 
259 // (0x8xx) Future records -----------------------------------------------------
260 
261 /** Enumerates different header types of future records. */
262 enum XclFutureRecType
263 {
264     EXC_FUTUREREC_SIMPLE,           /// Record identifier and empty flags field.
265     EXC_FUTUREREC_UNUSEDREF         /// Record identifier, empty flags field, unused range address.
266 };
267 
268 const sal_uInt16 EXC_FUTUREREC_EMPTYFLAGS   = 0x0000;
269 const sal_uInt16 EXC_FUTUREREC_HASREF       = 0x0001;
270 const sal_uInt16 EXC_FUTUREREC_ALERT        = 0x0002;
271 
272 // ============================================================================
273 
274 #endif
275 
276