1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XLCONST_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XLCONST_HXX
22 
23 #include <address.hxx>
24 
25 // Common =====================================================================
26 
27 // BIFF versions --------------------------------------------------------------
28 
29 /** An enumeration for all Excel file format types (BIFF types). */
30 enum XclBiff
31 {
32     EXC_BIFF2 = 0,              /// MS Excel 2.1
33     EXC_BIFF3,                  /// MS Excel 3.0
34     EXC_BIFF4,                  /// MS Excel 4.0
35     EXC_BIFF5,                  /// MS Excel 5.0, MS Excel 7.0 (95)
36     EXC_BIFF8,                  /// MS Excel 8.0 (97), 9.0 (2000), 10.0 (XP), 11.0 (2003)
37     EXC_BIFF_UNKNOWN            /// Unknown BIFF version.
38 };
39 
40 /** An enumeration for all Excel output format types. */
41 enum XclOutput
42 {
43     EXC_OUTPUT_BINARY,          /// MS Excel binary .xls
44     EXC_OUTPUT_XML_2007,        /// MS Excel 2007 .xlsx
45 };
46 
47 // Excel sheet dimensions -----------------------------------------------------
48 
49 const SCCOL EXC_MAXCOL2                     = 255;
50 const SCROW EXC_MAXROW2                     = 16383;
51 const SCTAB EXC_MAXTAB2                     = 0;
52 
53 const SCCOL EXC_MAXCOL3                     = EXC_MAXCOL2;
54 const SCROW EXC_MAXROW3                     = EXC_MAXROW2;
55 const SCTAB EXC_MAXTAB3                     = EXC_MAXTAB2;
56 
57 const SCCOL EXC_MAXCOL4                     = EXC_MAXCOL3;
58 const SCROW EXC_MAXROW4                     = EXC_MAXROW3;
59 const SCTAB EXC_MAXTAB4                     = 32767;
60 
61 const SCCOL EXC_MAXCOL5                     = EXC_MAXCOL4;
62 const SCROW EXC_MAXROW5                     = EXC_MAXROW4;
63 const SCTAB EXC_MAXTAB5                     = EXC_MAXTAB4;
64 
65 const SCCOL EXC_MAXCOL8                     = EXC_MAXCOL5;
66 const SCROW EXC_MAXROW8                     = 65535;
67 const SCTAB EXC_MAXTAB8                     = EXC_MAXTAB5;
68 
69 const SCCOL EXC_MAXCOL_XML_2007             = 16383;
70 const SCROW EXC_MAXROW_XML_2007             = 1048575;
71 const SCTAB EXC_MAXTAB_XML_2007             = 1023;
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              "LNK"
80 #define EXC_STORAGE_OLE_EMBEDDED            "MBD"
81 #define EXC_STORAGE_VBA_PROJECT             "_VBA_PROJECT_CUR"
82 
83 #define EXC_STREAM_BOOK                     "Book"
84 #define EXC_STREAM_WORKBOOK                 "Workbook"
85 #define EXC_STREAM_CTLS                     "Ctls"
86 
87 // Encoded URLs ---------------------------------------------------------------
88 
89 const sal_Unicode EXC_URLSTART_ENCODED      = '\x01';   /// Encoded URL.
90 const sal_Unicode EXC_URLSTART_SELF         = '\x02';   /// Reference to own workbook.
91 const sal_Unicode EXC_URLSTART_SELFENCODED  = '\x03';   /// Encoded self reference.
92 const sal_Unicode EXC_URLSTART_OWNDOC       = '\x04';   /// Reference to own workbook (BIFF5/BIFF7).
93 
94 const sal_Unicode EXC_URL_DOSDRIVE          = '\x01';   /// DOS drive letter or UNC server name.
95 const sal_Unicode EXC_URL_DRIVEROOT         = '\x02';   /// Root directory of current drive.
96 const sal_Unicode EXC_URL_SUBDIR            = '\x03';   /// Directory name delimiter.
97 const sal_Unicode EXC_URL_PARENTDIR         = '\x04';   /// Parent directory.
98 const sal_Unicode EXC_URL_RAW               = '\x05';   /// Unencoded URL.
99 const sal_Unicode EXC_URL_SHEETNAME         = '\x09';   /// Sheet name starts here (BIFF4).
100 
101 const sal_Unicode EXC_DDE_DELIM             = '\x03';   /// DDE application-topic delimiter
102 
103 // Error codes ----------------------------------------------------------------
104 
105 const sal_uInt8 EXC_ERR_NULL                = 0x00;
106 const sal_uInt8 EXC_ERR_DIV0                = 0x07;
107 const sal_uInt8 EXC_ERR_VALUE               = 0x0F;
108 const sal_uInt8 EXC_ERR_REF                 = 0x17;
109 const sal_uInt8 EXC_ERR_NAME                = 0x1D;
110 const sal_uInt8 EXC_ERR_NUM                 = 0x24;
111 const sal_uInt8 EXC_ERR_NA                  = 0x2A;
112 
113 // Cached values list (EXTERNNAME, ptgArray, ...) -----------------------------
114 
115 const sal_uInt8 EXC_CACHEDVAL_EMPTY         = 0x00;
116 const sal_uInt8 EXC_CACHEDVAL_DOUBLE        = 0x01;
117 const sal_uInt8 EXC_CACHEDVAL_STRING        = 0x02;
118 const sal_uInt8 EXC_CACHEDVAL_BOOL          = 0x04;
119 const sal_uInt8 EXC_CACHEDVAL_ERROR         = 0x10;
120 
121 // RK values ------------------------------------------------------------------
122 
123 const sal_Int32 EXC_RK_100FLAG              = 0x00000001;
124 const sal_Int32 EXC_RK_INTFLAG              = 0x00000002;
125 const sal_Int32 EXC_RK_VALUEMASK            = 0xFFFFFFFC;
126 
127 const sal_Int32 EXC_RK_DBL                  = 0x00000000;
128 const sal_Int32 EXC_RK_DBL100               = EXC_RK_100FLAG;
129 const sal_Int32 EXC_RK_INT                  = EXC_RK_INTFLAG;
130 const sal_Int32 EXC_RK_INT100               = EXC_RK_100FLAG | EXC_RK_INTFLAG;
131 
132 // Measures -------------------------------------------------------------------
133 
134 const sal_Int32 EXC_POINTS_PER_INCH         = 72;
135 const sal_Int32 EXC_TWIPS_PER_INCH          = EXC_POINTS_PER_INCH * 20;
136 
137 const double EXC_POINTS_PER_HMM             = static_cast< double >( EXC_POINTS_PER_INCH ) / 2540.0;
138 
139 const sal_uInt8 EXC_ORIENT_NONE             = 0;        /// Text orientation: not rotated.
140 const sal_uInt8 EXC_ORIENT_STACKED          = 1;        /// Text orientation: vertically stacked.
141 const sal_uInt8 EXC_ORIENT_90CCW            = 2;        /// Text orientation: 90 deg counterclockwise.
142 const sal_uInt8 EXC_ORIENT_90CW             = 3;        /// Text orientation: 90 deg clockwise.
143 
144 const sal_uInt8 EXC_ROT_NONE                = 0;        /// Text rotation: not rotated.
145 const sal_uInt8 EXC_ROT_90CCW               = 90;       /// Text rotation: 90 deg counterclockwise.
146 const sal_uInt8 EXC_ROT_90CW                = 180;      /// Text rotation: 90 deg clockwise.
147 const sal_uInt8 EXC_ROT_STACKED             = 255;      /// Text rotation: vertically stacked.
148 
149 // Records (ordered by lowest record ID) ======================================
150 
151 // (0x0009, 0x0209, 0x0409, 0x0809) BOF ---------------------------------------
152 
153 const sal_uInt16 EXC_ID2_BOF                = 0x0009;
154 const sal_uInt16 EXC_ID3_BOF                = 0x0209;
155 const sal_uInt16 EXC_ID4_BOF                = 0x0409;
156 const sal_uInt16 EXC_ID5_BOF                = 0x0809;
157 
158 const sal_uInt16 EXC_BOF_BIFF2              = 0x0200;
159 const sal_uInt16 EXC_BOF_BIFF3              = 0x0300;
160 const sal_uInt16 EXC_BOF_BIFF4              = 0x0400;
161 const sal_uInt16 EXC_BOF_BIFF5              = 0x0500;
162 const sal_uInt16 EXC_BOF_BIFF8              = 0x0600;
163 
164 const sal_uInt16 EXC_BOF_GLOBALS            = 0x0005;   /// BIFF5-BIFF8 workbook globals.
165 const sal_uInt16 EXC_BOF_VBMODULE           = 0x0006;   /// BIFF5-BIFF8 Visual BASIC module.
166 const sal_uInt16 EXC_BOF_SHEET              = 0x0010;   /// Regular worksheet.
167 const sal_uInt16 EXC_BOF_CHART              = 0x0020;   /// Chart sheet.
168 const sal_uInt16 EXC_BOF_MACROSHEET         = 0x0040;   /// Macro sheet.
169 const sal_uInt16 EXC_BOF_WORKSPACE          = 0x0100;   /// Workspace.
170 const sal_uInt16 EXC_BOF_UNKNOWN            = 0xFFFF;   /// Internal use only.
171 
172 // (0x000A) EOF ---------------------------------------------------------------
173 const sal_uInt16 EXC_ID_EOF                 = 0x000A;
174 
175 // (0x0012) PROTECT -----------------------------------------------------------
176 const sal_uInt16 EXC_ID_PROTECT             = 0x0012;
177 
178 // (0x0013) PASSWORD ----------------------------------------------------------
179 const sal_uInt16 EXC_ID_PASSWORD            = 0x0013;
180 
181 // (0x0019) WINDOWPROTECT -----------------------------------------------------
182 const sal_uInt16 EXC_ID_WINDOWPROTECT       = 0x0019;
183 
184 // (0x0042) CODEPAGE ----------------------------------------------------------
185 const sal_uInt16 EXC_ID_CODEPAGE            = 0x0042;
186 
187 // (0x0081) WSBOOL ------------------------------------------------------------
188 const sal_uInt16 EXC_ID_WSBOOL              = 0x0081;
189 
190 const sal_uInt16 EXC_WSBOOL_ROWBELOW        = 0x0040;
191 const sal_uInt16 EXC_WSBOOL_COLBELOW        = 0x0080;
192 const sal_uInt16 EXC_WSBOOL_FITTOPAGE       = 0x0100;
193 
194 const sal_uInt16 EXC_WSBOOL_DEFAULTFLAGS    = 0x04C1;
195 
196 // (0x0086) WRITEPROT ---------------------------------------------------------
197 const sal_uInt16 EXC_ID_WRITEPROT           = 0x0086;
198 
199 // (0x008C) COUNTRY -----------------------------------------------------------
200 const sal_uInt16 EXC_ID_COUNTRY             = 0x008C;
201 
202 // (0x009B) FILTERMODE --------------------------------------------------------
203 const sal_uInt16 EXC_ID_FILTERMODE          = 0x009B;
204 
205 // (0x009C) FNGROUPCOUNT ------------------------------------------------------
206 const sal_uInt16 EXC_ID_FNGROUPCOUNT        = 0x009C;
207 
208 // (0x009D) AUTOFILTERINFO ----------------------------------------------------
209 const sal_uInt16 EXC_ID_AUTOFILTERINFO      = 0x009D;
210 
211 // (0x009E) AUTOFILTER --------------------------------------------------------
212 const sal_uInt16 EXC_ID_AUTOFILTER          = 0x009E;
213 
214 // (0x00BF, 0x00C0, 0x00C1) TOOLBARHDR, TOOLBAREND, MMS -----------------------
215 const sal_uInt16 EXC_ID_TOOLBARHDR          = 0x00BF;
216 const sal_uInt16 EXC_ID_TOOLBAREND          = 0x00C0;
217 const sal_uInt16 EXC_ID_MMS                 = 0x00C1;
218 
219 // (0x00E1, 0x00E2) INTERFACEHDR, INTERFACEEND --------------------------------
220 const sal_uInt16 EXC_ID_INTERFACEHDR        = 0x00E1;
221 const sal_uInt16 EXC_ID_INTERFACEEND        = 0x00E2;
222 
223 // (0x0160) USESELFS ----------------------------------------------------------
224 const sal_uInt16 EXC_ID_USESELFS            = 0x0160;
225 
226 // (0x0161) DSF ---------------------------------------------------------------
227 const sal_uInt16 EXC_ID_DSF                 = 0x0161;
228 
229 // (0x01AA,0x01AB) USERSVIEWBEGIN, USERSVIEWEND -------------------------------
230 const sal_uInt16 EXC_ID_USERSVIEWBEGIN      = 0x01AA;
231 const sal_uInt16 EXC_ID_USERSVIEWEND        = 0x01AB;
232 
233 // (0x01BA) CODENAME ----------------------------------------------------------
234 const sal_uInt16 EXC_ID_CODENAME            = 0x01BA;
235 
236 // (0x01C0) XL9FILE -----------------------------------------------------------
237 const sal_uInt16 EXC_ID_XL9FILE             = 0x01C0;
238 
239 // (0x8xx) Future records -----------------------------------------------------
240 
241 /** Enumerates different header types of future records. */
242 enum XclFutureRecType
243 {
244     EXC_FUTUREREC_SIMPLE,           /// Record identifier and empty flags field.
245     EXC_FUTUREREC_UNUSEDREF         /// Record identifier, empty flags field, unused range address.
246 };
247 
248 const sal_uInt16 EXC_FUTUREREC_EMPTYFLAGS   = 0x0000;
249 const sal_uInt16 EXC_FUTUREREC_HASREF       = 0x0001;
250 const sal_uInt16 EXC_FUTUREREC_ALERT        = 0x0002;
251 
252 // Border import/export
253 
254 const sal_uInt16 EXC_BORDER_THICK  = 50;
255 const sal_uInt16 EXC_BORDER_MEDIUM = 35;
256 const sal_uInt16 EXC_BORDER_THIN   = 15;
257 const sal_uInt16 EXC_BORDER_HAIR   = 1;
258 
259 // SharedFeatureType enumeration
260 const sal_uInt16 EXC_ISFPROTECTION = 0x0002;
261 const sal_uInt16 EXC_ISFFEC2       = 0x0003;
262 const sal_uInt16 EXC_ISFFACTOID    = 0x0004;
263 const sal_uInt16 EXC_ISFLIST       = 0x0005;
264 
265 #endif
266 
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
268