Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / inc / xlstyle.hxx
blob70fd39121c3eeef55847905ce59a2aa02e61b5c2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XLSTYLE_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XLSTYLE_HXX
23 #include <map>
24 #include <com/sun/star/awt/FontSlant.hpp>
25 #include <tools/color.hxx>
26 #include <tools/fontenum.hxx>
27 #include <editeng/svxenum.hxx>
28 #include <editeng/frmdir.hxx>
29 #include <svl/zforlist.hxx>
30 #include "fapihelper.hxx"
32 class XclRoot;
34 // Constants and Enumerations =================================================
36 // Line styles ----------------------------------------------------------------
38 const sal_uInt8 EXC_LINE_NONE = 0x00;
39 const sal_uInt8 EXC_LINE_THIN = 0x01;
40 const sal_uInt8 EXC_LINE_MEDIUM = 0x02;
41 const sal_uInt8 EXC_LINE_DASHED = 0x03;
42 const sal_uInt8 EXC_LINE_DOTTED = 0x04;
43 const sal_uInt8 EXC_LINE_THICK = 0x05;
44 const sal_uInt8 EXC_LINE_DOUBLE = 0x06;
45 const sal_uInt8 EXC_LINE_HAIR = 0x07;
46 const sal_uInt8 EXC_LINE_MEDIUM_DASHED = 0x08;
47 const sal_uInt8 EXC_LINE_THIN_DASHDOT = 0x09;
48 const sal_uInt8 EXC_LINE_MEDIUM_DASHDOT = 0x0A;
49 const sal_uInt8 EXC_LINE_THIN_DASHDOTDOT = 0x0B;
50 const sal_uInt8 EXC_LINE_MEDIUM_DASHDOTDOT = 0x0C;
51 const sal_uInt8 EXC_LINE_MEDIUM_SLANT_DASHDOT = 0x0D;
53 // Background patterns --------------------------------------------------------
55 const sal_uInt8 EXC_PATT_NONE = 0x00;
56 const sal_uInt8 EXC_PATT_SOLID = 0x01;
57 const sal_uInt8 EXC_PATT_50_PERC = 0x02;
58 const sal_uInt8 EXC_PATT_75_PERC = 0x03;
59 const sal_uInt8 EXC_PATT_25_PERC = 0x04;
60 const sal_uInt8 EXC_PATT_12_5_PERC = 0x11;
61 const sal_uInt8 EXC_PATT_6_25_PERC = 0x12;
63 // (0x001E, 0x041E) FORMAT ----------------------------------------------------
65 const sal_uInt16 EXC_ID2_FORMAT = 0x001E;
66 const sal_uInt16 EXC_ID4_FORMAT = 0x041E;
68 const sal_uInt16 EXC_FORMAT_OFFSET5 = 164;
69 const sal_uInt16 EXC_FORMAT_OFFSET8 = 164;
70 const sal_uInt16 EXC_FORMAT_NOTFOUND = 0xFFFF;
72 // (0x0031) FONT --------------------------------------------------------------
74 const sal_uInt16 EXC_ID2_FONT = 0x0031;
75 const sal_uInt16 EXC_ID3_FONT = 0x0231;
77 const sal_uInt16 EXC_FONT_APP = 0; /// Application font index.
78 const sal_uInt16 EXC_FONT_NOTFOUND = 0xFFFF;
80 const size_t EXC_FONT_MAXCOUNT4 = 0x00FF;
81 const size_t EXC_FONT_MAXCOUNT5 = 0x00FF;
82 const size_t EXC_FONT_MAXCOUNT8 = 0xFFFF;
84 // families
85 const sal_uInt8 EXC_FONTFAM_DONTKNOW = 0x00;
86 const sal_uInt8 EXC_FONTFAM_ROMAN = 0x01;
87 const sal_uInt8 EXC_FONTFAM_SWISS = 0x02;
88 const sal_uInt8 EXC_FONTFAM_SYSTEM = EXC_FONTFAM_SWISS;
89 const sal_uInt8 EXC_FONTFAM_MODERN = 0x03;
90 const sal_uInt8 EXC_FONTFAM_SCRIPT = 0x04;
91 const sal_uInt8 EXC_FONTFAM_DECORATIVE = 0x05;
93 // charsets
94 const sal_uInt8 EXC_FONTCSET_ANSI_LATIN = 0x00;
96 // attributes
97 const sal_uInt16 EXC_FONTATTR_NONE = 0x0000;
98 const sal_uInt16 EXC_FONTATTR_BOLD = 0x0001;
99 const sal_uInt16 EXC_FONTATTR_ITALIC = 0x0002;
100 const sal_uInt16 EXC_FONTATTR_UNDERLINE = 0x0004;
101 const sal_uInt16 EXC_FONTATTR_STRIKEOUT = 0x0008;
102 const sal_uInt16 EXC_FONTATTR_OUTLINE = 0x0010;
103 const sal_uInt16 EXC_FONTATTR_SHADOW = 0x0020;
105 // weight
106 const sal_uInt16 EXC_FONTWGHT_DONTKNOW = 0;
107 const sal_uInt16 EXC_FONTWGHT_THIN = 100;
108 const sal_uInt16 EXC_FONTWGHT_ULTRALIGHT = 200;
109 const sal_uInt16 EXC_FONTWGHT_LIGHT = 300;
110 const sal_uInt16 EXC_FONTWGHT_SEMILIGHT = 350;
111 const sal_uInt16 EXC_FONTWGHT_NORMAL = 400;
112 const sal_uInt16 EXC_FONTWGHT_MEDIUM = 500;
113 const sal_uInt16 EXC_FONTWGHT_SEMIBOLD = 600;
114 const sal_uInt16 EXC_FONTWGHT_BOLD = 700;
115 const sal_uInt16 EXC_FONTWGHT_ULTRABOLD = 800;
116 const sal_uInt16 EXC_FONTWGHT_BLACK = 900;
118 // underline
119 const sal_uInt8 EXC_FONTUNDERL_NONE = 0x00;
120 const sal_uInt8 EXC_FONTUNDERL_SINGLE = 0x01;
121 const sal_uInt8 EXC_FONTUNDERL_DOUBLE = 0x02;
122 const sal_uInt8 EXC_FONTUNDERL_SINGLE_ACC = 0x21;
123 const sal_uInt8 EXC_FONTUNDERL_DOUBLE_ACC = 0x22;
125 // escapement
126 const sal_uInt16 EXC_FONTESC_NONE = 0x00;
127 const sal_uInt16 EXC_FONTESC_SUPER = 0x01;
128 const sal_uInt16 EXC_FONTESC_SUB = 0x02;
130 // (0x0043, 0x0243, 0x0443, 0x00E0) XF ----------------------------------------
132 const sal_uInt16 EXC_ID2_XF = 0x0043;
133 const sal_uInt16 EXC_ID3_XF = 0x0243;
134 const sal_uInt16 EXC_ID4_XF = 0x0443;
135 const sal_uInt16 EXC_ID5_XF = 0x00E0;
137 const sal_uInt32 EXC_XF_MAXCOUNT = 4050; /// Maximum number of all XF records.
138 const sal_uInt32 EXC_XF_MAXSTYLECOUNT = 1536; /// Arbitrary maximum number of style XFs.
139 const sal_uInt16 EXC_XF_DEFAULTSTYLE = 0; /// Excel index to default style XF.
140 const sal_uInt16 EXC_XF_DEFAULTCELL = 15; /// Excel index to default cell XF.
141 const sal_uInt16 EXC_XF_NOTFOUND = 0xFFFF; /// Special index for "not found" state.
143 const sal_uInt32 EXC_XFID_NOTFOUND = 0xFFFFFFFF;
145 const sal_uInt16 EXC_XF_LOCKED = 0x0001;
146 const sal_uInt16 EXC_XF_HIDDEN = 0x0002;
147 const sal_uInt16 EXC_XF_STYLE = 0x0004;
148 const sal_uInt16 EXC_XF_STYLEPARENT = 0x0FFF; /// Styles don't have a parent.
149 const sal_uInt16 EXC_XF_LINEBREAK = 0x0008; /// Automatic line break.
150 const sal_uInt16 EXC_XF_SHRINK = 0x0010; /// Shrink to fit into cell.
152 const sal_uInt8 EXC_XF_DIFF_VALFMT = 0x01;
153 const sal_uInt8 EXC_XF_DIFF_FONT = 0x02;
154 const sal_uInt8 EXC_XF_DIFF_ALIGN = 0x04;
155 const sal_uInt8 EXC_XF_DIFF_BORDER = 0x08;
156 const sal_uInt8 EXC_XF_DIFF_AREA = 0x10;
157 const sal_uInt8 EXC_XF_DIFF_PROT = 0x20;
159 const sal_uInt8 EXC_XF_HOR_GENERAL = 0x00;
160 const sal_uInt8 EXC_XF_HOR_LEFT = 0x01;
161 const sal_uInt8 EXC_XF_HOR_CENTER = 0x02;
162 const sal_uInt8 EXC_XF_HOR_RIGHT = 0x03;
163 const sal_uInt8 EXC_XF_HOR_FILL = 0x04;
164 const sal_uInt8 EXC_XF_HOR_JUSTIFY = 0x05;
165 const sal_uInt8 EXC_XF_HOR_CENTER_AS = 0x06;
166 const sal_uInt8 EXC_XF_HOR_DISTRIB = 0x07;
168 const sal_uInt8 EXC_XF_VER_TOP = 0x00;
169 const sal_uInt8 EXC_XF_VER_CENTER = 0x01;
170 const sal_uInt8 EXC_XF_VER_BOTTOM = 0x02;
171 const sal_uInt8 EXC_XF_VER_JUSTIFY = 0x03;
172 const sal_uInt8 EXC_XF_VER_DISTRIB = 0x04;
174 const sal_uInt8 EXC_XF_TEXTDIR_CONTEXT = 0x00;
175 const sal_uInt8 EXC_XF_TEXTDIR_LTR = 0x01;
176 const sal_uInt8 EXC_XF_TEXTDIR_RTL = 0x02;
178 const sal_uInt8 EXC_XF2_VALFMT_MASK = 0x3F;
179 const sal_uInt8 EXC_XF2_LOCKED = 0x40;
180 const sal_uInt8 EXC_XF2_HIDDEN = 0x80;
181 const sal_uInt8 EXC_XF2_LEFTLINE = 0x08;
182 const sal_uInt8 EXC_XF2_RIGHTLINE = 0x10;
183 const sal_uInt8 EXC_XF2_TOPLINE = 0x20;
184 const sal_uInt8 EXC_XF2_BOTTOMLINE = 0x40;
185 const sal_uInt8 EXC_XF2_BACKGROUND = 0x80;
187 const sal_uInt16 EXC_XF8_SHRINK = 0x0010; /// Shrink to fit into cell.
188 const sal_uInt16 EXC_XF8_MERGE = 0x0020;
190 const sal_uInt32 EXC_XF_DIAGONAL_TL_TO_BR = 0x40000000; /// Top-left to bottom-right.
191 const sal_uInt32 EXC_XF_DIAGONAL_BL_TO_TR = 0x80000000; /// Bottom-left to top-right.
192 const sal_uInt32 EXC_XF_DIAGONAL_BOTH = 0xC0000000; /// Both.
194 // (0x0045) EFONT -------------------------------------------------------------
196 const sal_uInt16 EXC_ID_EFONT = 0x0045;
198 // (0x0092) PALETTE -----------------------------------------------------------
200 const sal_uInt16 EXC_ID_PALETTE = 0x0092;
202 const sal_uInt16 EXC_COLOR_BIFF2_BLACK = 0;
203 const sal_uInt16 EXC_COLOR_BIFF2_WHITE = 1;
205 const sal_uInt16 EXC_COLOR_USEROFFSET = 8; /// First user defined color.
206 const sal_uInt16 EXC_COLOR_WINDOWTEXT3 = 24; /// System window text color (BIFF3-BIFF4).
207 const sal_uInt16 EXC_COLOR_WINDOWBACK3 = 25; /// System window background color (BIFF3-BIFF4).
208 const sal_uInt16 EXC_COLOR_WINDOWTEXT = 64; /// System window text color (>=BIFF5).
209 const sal_uInt16 EXC_COLOR_WINDOWBACK = 65; /// System window background color (>=BIFF5).
210 const sal_uInt16 EXC_COLOR_BUTTONBACK = 67; /// System button background color (face color).
211 const sal_uInt16 EXC_COLOR_CHWINDOWTEXT = 77; /// System window text color (BIFF8 charts).
212 const sal_uInt16 EXC_COLOR_CHWINDOWBACK = 78; /// System window background color (BIFF8 charts).
213 const sal_uInt16 EXC_COLOR_CHBORDERAUTO = 79; /// Automatic frame border for series (BIFF8 charts).
214 const sal_uInt16 EXC_COLOR_NOTEBACK = 80; /// Note background color.
215 const sal_uInt16 EXC_COLOR_NOTETEXT = 81; /// Note text color.
216 const sal_uInt16 EXC_COLOR_FONTAUTO = 0x7FFF; /// Font auto color (system window text color).
218 // (0x0293) STYLE -------------------------------------------------------------
220 const sal_uInt16 EXC_ID_STYLE = 0x0293;
222 const sal_uInt16 EXC_STYLE_BUILTIN = 0x8000;
223 const sal_uInt16 EXC_STYLE_XFMASK = 0x0FFF;
225 const sal_uInt8 EXC_STYLE_NORMAL = 0x00; /// "Normal" style.
226 const sal_uInt8 EXC_STYLE_ROWLEVEL = 0x01; /// "RowLevel_*" styles.
227 const sal_uInt8 EXC_STYLE_COLLEVEL = 0x02; /// "ColLevel_*" styles.
228 const sal_uInt8 EXC_STYLE_COMMA = 0x03; /// "Comma" style.
229 const sal_uInt8 EXC_STYLE_CURRENCY = 0x04; /// "Currency" style.
230 const sal_uInt8 EXC_STYLE_PERCENT = 0x05; /// "Percent" style.
231 const sal_uInt8 EXC_STYLE_COMMA_0 = 0x06; /// "Comma [0]" style.
232 const sal_uInt8 EXC_STYLE_CURRENCY_0 = 0x07; /// "Currency [0]" style.
233 const sal_uInt8 EXC_STYLE_HYPERLINK = 0x08; /// "Hyperlink" style.
234 const sal_uInt8 EXC_STYLE_FOLLOWED_HYPERLINK= 0x09; /// "Followed_Hyperlink" style.
235 const sal_uInt8 EXC_STYLE_USERDEF = 0xFF; /// No built-in style.
237 const sal_uInt8 EXC_STYLE_LEVELCOUNT = 7; /// Number of outline level styles.
238 const sal_uInt8 EXC_STYLE_NOLEVEL = 0xFF; /// Default value for unused level.
240 // (0x0892) STYLEEXT ----------------------------------------------------------
242 const sal_uInt16 EXC_ID_STYLEEXT = 0x0892;
244 const sal_uInt8 EXC_STYLEEXT_BUILTIN = 0x01;
245 const sal_uInt8 EXC_STYLEEXT_HIDDEN = 0x02;
246 const sal_uInt8 EXC_STYLEEXT_CUSTOM = 0x04;
248 // Color data =================================================================
250 /** Stores all default colors for a specific BIFF version. */
251 class XclDefaultPalette
253 public:
254 explicit XclDefaultPalette( const XclRoot& rRoot );
256 /** Returns the color count in the current palette. */
257 sal_uInt32 GetColorCount() const { return mnTableSize - EXC_COLOR_USEROFFSET; }
259 /** Returns the default color for a (non-zero-based) Excel color or COL_AUTO on error. */
260 Color GetDefColor( sal_uInt16 nXclIndex ) const;
262 /** Returns true, if the passed Excel color index is a system color. */
263 bool IsSystemColor( sal_uInt16 nXclIndex ) const { return nXclIndex >= mnTableSize; }
265 private:
266 const Color* mpnColorTable; /// The table with RGB values.
267 Color mnWindowText; /// System window text color.
268 Color mnWindowBack; /// System window background color.
269 Color mnFaceColor; /// System button background color.
270 Color mnNoteText; /// Note text color.
271 Color mnNoteBack; /// Note background color.
272 sal_uInt32 mnTableSize; /// The color table size.
275 // Font data ==================================================================
277 namespace vcl { class Font; }
278 class SvxFont;
280 /** This struct helps reading and writing Excel fonts.
282 It stores all Excel compatible properties of a font. In detail this is the
283 name, family, character set, height, color, boldness, posture, script,
284 underline, strikeout, outline and shadow of the font.
286 struct XclFontData
288 OUString maName; /// Font name.
289 OUString maStyle; /// String with styles (bold, italic).
290 Color maColor; /// Font color.
291 sal_uInt16 mnHeight; /// Font height in twips (1/20 of a point).
292 sal_uInt16 mnWeight; /// Boldness: 400=normal, 700=bold.
293 sal_uInt16 mnEscapem; /// Escapement type.
294 sal_uInt8 mnFamily; /// Windows font family.
295 sal_uInt8 mnCharSet; /// Windows character set.
296 sal_uInt8 mnUnderline; /// Underline style.
297 bool mbItalic; /// true = Italic.
298 bool mbStrikeout; /// true = Struck out.
299 bool mbOutline; /// true = Outlined.
300 bool mbShadow; /// true = Shadowed.
302 /** Constructs an empty font data structure. */
303 explicit XclFontData();
304 /** Constructs a font data structure and fills it with the passed font attributes (except color). */
305 explicit XclFontData( const vcl::Font& rFont );
306 /** As directly above but also fills in the escapement member. */
307 explicit XclFontData( const SvxFont& rFont );
309 /** Resets all members to default (empty) values. */
310 void Clear();
311 /** Fills all members (except color and escapement) from the passed font. */
312 void FillFromVclFont( const vcl::Font& rFont );
313 /** Fills all members (except color) from the passed SVX font. */
314 void FillFromSvxFont( const SvxFont& rFont );
316 // *** conversion of VCL/SVX constants *** ------------------------------------
318 /** Returns the Calc font family. */
319 FontFamily GetScFamily( rtl_TextEncoding eDefTextEnc ) const;
320 /** Returns the font text encoding. */
321 rtl_TextEncoding GetFontEncoding() const;
322 /** Returns the Calc font posture. */
323 FontItalic GetScPosture() const;
324 /** Returns the Calc font weight. */
325 FontWeight GetScWeight() const;
326 /** Returns the Calc font underline style. */
327 FontLineStyle GetScUnderline() const;
328 /** Returns the Calc escapement style. */
329 SvxEscapement GetScEscapement() const;
330 /** Returns the Calc strike-out style. */
331 FontStrikeout GetScStrikeout() const;
333 /** Sets the Calc font height (in twips). */
334 void SetScHeight( sal_Int32 nTwips );
335 /** Sets the Calc font family. */
336 void SetScFamily( FontFamily eScFamily );
337 /** Sets the font text encoding. */
338 void SetFontEncoding( rtl_TextEncoding eFontEnc );
339 /** Sets the Calc font posture. */
340 void SetScPosture( FontItalic eScPosture );
341 /** Sets the Calc font weight. */
342 void SetScWeight( FontWeight eScWeight );
343 /** Sets the Calc underline style. */
344 void SetScUnderline( FontLineStyle eScUnderl );
345 /** Sets the Calc escapement style. */
346 void SetScEscapement( short nScEscapem );
347 /** Sets the Calc strike-out style. */
348 void SetScStrikeout( FontStrikeout eScStrikeout );
350 // *** conversion of API constants *** ----------------------------------------
352 /** Returns the API font height. */
353 float GetApiHeight() const;
354 /** Returns the API font family. */
355 sal_Int16 GetApiFamily() const;
356 /** Returns the API font text encoding. */
357 sal_Int16 GetApiFontEncoding() const;
358 /** Returns the API font posture. */
359 css::awt::FontSlant GetApiPosture() const;
360 /** Returns the API font weight. */
361 float GetApiWeight() const;
362 /** Returns the API font underline style. */
363 sal_Int16 GetApiUnderline() const;
364 /** Returns the API escapement style. */
365 sal_Int16 GetApiEscapement() const;
366 /** Returns the API font strike-out style. */
367 sal_Int16 GetApiStrikeout() const;
369 /** Sets the API font height. */
370 void SetApiHeight( float fPoint );
371 /** Sets the API font family. */
372 void SetApiFamily( sal_Int16 nApiFamily );
373 /** Sets the API font posture. */
374 void SetApiPosture( css::awt::FontSlant eApiPosture );
375 /** Sets the API font weight. */
376 void SetApiWeight( float fApiWeight );
377 /** Sets the API font underline style. */
378 void SetApiUnderline( sal_Int16 nApiUnderl );
379 /** Sets the API escapement style. */
380 void SetApiEscapement( sal_Int16 nApiEscapem );
381 /** Sets the API font strike-out style. */
382 void SetApiStrikeout( sal_Int16 nApiStrikeout );
385 bool operator==( const XclFontData& rLeft, const XclFontData& rRight );
387 /** Enumerates different types of Which-IDs for font items. */
388 enum class XclFontItemType
390 Cell, /// Use Calc Which-IDs (ATTR_*).
391 Editeng, /// Use edit engine Which-IDs (EE_CHAR_*).
392 HeaderFooter /// Use header/footer edit engine Which-IDs (EE_CHAR_*).
395 /** Enumerates different types for objects with font settings (using different property names). */
396 enum XclFontPropSetType
398 EXC_FONTPROPSET_CHART, /// All text objects in charts.
399 EXC_FONTPROPSET_CONTROL /// Text formatting in form controls.
402 /** Helper class for usage of property sets. */
403 class XclFontPropSetHelper
405 public:
406 explicit XclFontPropSetHelper();
408 /** Reads all font properties from the passed property set. */
409 void ReadFontProperties( XclFontData& rFontData,
410 const ScfPropertySet& rPropSet, XclFontPropSetType eType,
411 sal_Int16 nScript = -1 );
413 /** Writes all font properties to the passed property set, uses passed color as font color. */
414 void WriteFontProperties(
415 ScfPropertySet& rPropSet, XclFontPropSetType eType,
416 const XclFontData& rFontData,
417 bool bHasWstrn, bool bHasAsian, bool bHasCmplx,
418 const Color* pFontColor );
420 private:
421 /** Returns a chart property set helper according to the passed script type. */
422 ScfPropSetHelper& GetChartHelper( sal_Int16 nScript );
424 private:
425 ScfPropSetHelper maHlpChCommon; /// Chart properties for all scripts.
426 ScfPropSetHelper maHlpChWstrn; /// Chart properties for Western script.
427 ScfPropSetHelper maHlpChAsian; /// Chart properties for Asian script.
428 ScfPropSetHelper maHlpChCmplx; /// Chart properties for Complex script.
429 ScfPropSetHelper maHlpChWstrnNoName; /// Chart properties for Western script, no font name.
430 ScfPropSetHelper maHlpChAsianNoName; /// Chart properties for Asian script, no font name.
431 ScfPropSetHelper maHlpChCmplxNoName; /// Chart properties for Complex script, no font name.
432 ScfPropSetHelper maHlpChEscapement; /// Chart properties for font escapement.
433 ScfPropSetHelper maHlpControl; /// Properties for form controls.
436 // Number formats =============================================================
438 struct XclNumFmt
440 OUString maFormat; /// Format string, may be empty (meOffset used then).
441 NfIndexTableOffset meOffset; /// SvNumberFormatter format index, if maFormat is empty.
442 LanguageType meLanguage; /// Language type to be set with the number format.
445 class XclNumFmtBuffer
447 public:
448 explicit XclNumFmtBuffer( const XclRoot& rRoot );
450 /** Returns the core index of the current standard number format. */
451 sal_uInt32 GetStdScNumFmt() const { return mnStdScNumFmt; }
453 protected:
454 typedef ::std::map< sal_uInt16, XclNumFmt > XclNumFmtMap;
456 /** Clears all buffered data, used to set up for a new sheet. */
457 void InitializeImport();
459 /** Returns the current number format map. */
460 const XclNumFmtMap& GetFormatMap() const { return maFmtMap; }
462 /** Inserts a new number format for the specified Excel format index. */
463 void InsertFormat( sal_uInt16 nXclNumFmt, const OUString& rFormat );
465 private:
466 /** Inserts built-in number formats for the current system language. */
467 void InsertBuiltinFormats();
469 XclNumFmtMap maFmtMap; /// Map containing all default and user-defined formats.
470 const LanguageType meSysLang; /// Current system language.
471 const sal_uInt32 mnStdScNumFmt; /// Calc format key for standard number format.
474 // Cell formatting data (XF) ==================================================
476 /** Contains all cell protection attributes. */
477 struct XclCellProt
479 bool mbLocked; /// true = Locked against editing.
480 bool mbHidden; /// true = Formula is hidden.
482 explicit XclCellProt();
485 bool operator==( const XclCellProt& rLeft, const XclCellProt& rRight );
487 /** Contains all cell alignment attributes. */
488 struct XclCellAlign
490 sal_uInt8 mnHorAlign; /// Horizontal alignment.
491 sal_uInt8 mnVerAlign; /// Vertical alignment.
492 sal_uInt8 mnOrient; /// Text orientation.
493 sal_uInt8 mnTextDir; /// CTL text direction.
494 sal_uInt8 mnRotation; /// Text rotation angle.
495 sal_uInt8 mnIndent; /// Indentation.
496 bool mbLineBreak; /// true = Multi-line text.
497 bool mbShrink; /// true = Shrink to fit cell size.
499 explicit XclCellAlign();
501 /** Returns the Calc horizontal alignment. */
502 SvxCellHorJustify GetScHorAlign() const;
503 /** Returns horizontal justification method as Calc's attribute. */
504 SvxCellJustifyMethod GetScHorJustifyMethod() const;
505 /** Returns the Calc vertical alignment. */
506 SvxCellVerJustify GetScVerAlign() const;
507 /** Returns vertical justification method as Calc's attribute. */
508 SvxCellJustifyMethod GetScVerJustifyMethod() const;
509 /** Returns the Calc frame direction. */
510 SvxFrameDirection GetScFrameDir() const;
512 /** Sets the Calc horizontal alignment. */
513 void SetScHorAlign( SvxCellHorJustify eHorJust );
514 /** Sets the Calc vertical alignment. */
515 void SetScVerAlign( SvxCellVerJustify eVerJust );
516 /** Sets the Calc frame direction. */
517 void SetScFrameDir( SvxFrameDirection eFrameDir );
520 bool operator==( const XclCellAlign& rLeft, const XclCellAlign& rRight );
522 /** Contains color and line style for each cell border line. */
523 struct XclCellBorder
525 sal_uInt16 mnLeftColor; /// Palette index for left line.
526 sal_uInt16 mnRightColor; /// Palette index for right line.
527 sal_uInt16 mnTopColor; /// Palette index for top line.
528 sal_uInt16 mnBottomColor; /// Palette index for bottom line.
529 sal_uInt16 mnDiagColor; /// Palette index for diagonal line(s).
530 sal_uInt8 mnLeftLine; /// Style of left line.
531 sal_uInt8 mnRightLine; /// Style of right line.
532 sal_uInt8 mnTopLine; /// Style of top line.
533 sal_uInt8 mnBottomLine; /// Style of bottom line.
534 sal_uInt8 mnDiagLine; /// Style of diagonal line(s).
535 bool mbDiagTLtoBR; /// true = Top-left to bottom-right on.
536 bool mbDiagBLtoTR; /// true = Bottom-left to top-right on.
538 explicit XclCellBorder();
541 bool operator==( const XclCellBorder& rLeft, const XclCellBorder& rRight );
543 /** Contains background colors and pattern for a cell. */
544 struct XclCellArea
546 sal_uInt16 mnForeColor; /// Palette index to foreground color.
547 sal_uInt16 mnBackColor; /// Palette index to background color.
548 sal_uInt8 mnPattern; /// Fill pattern.
550 explicit XclCellArea();
552 /** Returns true, if the area represents transparent state. */
553 bool IsTransparent() const;
556 bool operator==( const XclCellArea& rLeft, const XclCellArea& rRight );
558 /** Contains base members for XF record import/export.
559 @descr In detail this class stores the XF type (cell/style), the index to the
560 parent style XF and all "attribute used" flags, which reflect the state of
561 specific attribute groups (true = user has changed the attributes). */
562 class XclXFBase
564 public:
565 explicit XclXFBase( bool bCellXF );
566 virtual ~XclXFBase();
568 XclXFBase(XclXFBase const &) = default;
569 XclXFBase(XclXFBase &&) = default;
570 XclXFBase & operator =(XclXFBase const &) = default;
571 XclXFBase & operator =(XclXFBase &&) = default;
573 /** Sets all "attribute used" flags to the passed state. */
574 void SetAllUsedFlags( bool bUsed );
575 /** Returns true, if any "attribute used" flags are ste in this XF. */
576 bool HasUsedFlags() const;
578 /** Returns true, if this is a hard cell format. */
579 bool IsCellXF() const { return mbCellXF; }
580 /** Returns true, if this is a cell style. */
581 bool IsStyleXF() const { return !IsCellXF(); }
583 protected:
584 /** Returns true, if this object is equal to the passed. */
585 bool Equals( const XclXFBase& rCmp ) const;
587 protected:
588 sal_uInt16 mnParent; /// Index to parent style XF.
589 bool mbCellXF; /// true = cell XF, false = style XF.
590 bool mbProtUsed; /// true = cell protection used.
591 bool mbFontUsed; /// true = font index used.
592 bool mbFmtUsed; /// true = number format used.
593 bool mbAlignUsed; /// true = alignment used.
594 bool mbBorderUsed; /// true = border data used.
595 bool mbAreaUsed; /// true = area data used.
598 #endif
600 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */