1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include <com/sun/star/awt/FontSlant.hpp>
24 #include <docmodel/color/ComplexColor.hxx>
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"
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;
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;
94 const sal_uInt8 EXC_FONTCSET_ANSI_LATIN
= 0x00;
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;
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;
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;
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; /// Chart window text color (BIFF8 charts).
212 const sal_uInt16 EXC_COLOR_CHWINDOWBACK
= 78; /// Chart 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
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
; }
266 const Color
* mpnColorTable
; /// The table with RGB values.
267 Color mnFaceColor
; /// System button background color.
268 Color mnNoteText
; /// Note text color.
269 Color mnNoteBack
; /// Note background color.
270 sal_uInt32 mnTableSize
; /// The color table size.
273 // Font data ==================================================================
275 namespace vcl
{ class Font
; }
278 /** This struct helps reading and writing Excel fonts.
280 It stores all Excel compatible properties of a font. In detail this is the
281 name, family, character set, height, color, boldness, posture, script,
282 underline, strikeout, outline and shadow of the font.
286 OUString maName
; /// Font name.
287 OUString maStyle
; /// String with styles (bold, italic).
288 sal_uInt16 mnHeight
; /// Font height in twips (1/20 of a point).
289 sal_uInt16 mnWeight
; /// Boldness: 400=normal, 700=bold.
290 sal_uInt16 mnEscapem
; /// Escapement type.
291 sal_uInt8 mnFamily
; /// Windows font family.
292 sal_uInt8 mnCharSet
; /// Windows character set.
293 sal_uInt8 mnUnderline
; /// Underline style.
294 bool mbItalic
; /// true = Italic.
295 bool mbStrikeout
; /// true = Struck out.
296 bool mbOutline
; /// true = Outlined.
297 bool mbShadow
; /// true = Shadowed.
299 model::ComplexColor maComplexColor
; /// Font color.
301 /** Constructs an empty font data structure. */
302 explicit XclFontData();
303 /** Constructs a font data structure and fills it with the passed font attributes (except color). */
304 explicit XclFontData(const vcl::Font
& rFont
, model::ComplexColor
const& rComplexColor
);
305 /** As directly above but also fills in the escapement member. */
306 explicit XclFontData(const SvxFont
& rFont
, model::ComplexColor
const& rComplexColor
);
308 /** Resets all members to default (empty) values. */
310 /** Fills all members (except color and escapement) from the passed font. */
311 void FillFromVclFont(const vcl::Font
& rFont
, model::ComplexColor
const& rComplexColor
);
312 /** Fills all members (except color) from the passed SVX font. */
313 void FillFromSvxFont(const SvxFont
& rFont
, model::ComplexColor
const& rComplexColor
);
315 // *** conversion of VCL/SVX constants *** ------------------------------------
317 /** Returns the Calc font family. */
318 FontFamily
GetScFamily( rtl_TextEncoding eDefTextEnc
) const;
319 /** Returns the font text encoding. */
320 rtl_TextEncoding
GetFontEncoding() const;
321 /** Returns the Calc font posture. */
322 FontItalic
GetScPosture() const;
323 /** Returns the Calc font weight. */
324 FontWeight
GetScWeight() const;
325 /** Returns the Calc font underline style. */
326 FontLineStyle
GetScUnderline() const;
327 /** Returns the Calc escapement style. */
328 SvxEscapement
GetScEscapement() const;
329 /** Returns the Calc strike-out style. */
330 FontStrikeout
GetScStrikeout() const;
332 /** Sets the Calc font height (in twips). */
333 void SetScHeight( sal_Int32 nTwips
);
334 /** Sets the Calc font family. */
335 void SetScFamily( FontFamily eScFamily
);
336 /** Sets the font text encoding. */
337 void SetFontEncoding( rtl_TextEncoding eFontEnc
);
338 /** Sets the Calc font posture. */
339 void SetScPosture( FontItalic eScPosture
);
340 /** Sets the Calc font weight. */
341 void SetScWeight( FontWeight eScWeight
);
342 /** Sets the Calc underline style. */
343 void SetScUnderline( FontLineStyle eScUnderl
);
344 /** Sets the Calc escapement style. */
345 void SetScEscapement( short nScEscapem
);
346 /** Sets the Calc strike-out style. */
347 void SetScStrikeout( FontStrikeout eScStrikeout
);
349 // *** conversion of API constants *** ----------------------------------------
351 /** Returns the API font height. */
352 float GetApiHeight() const;
353 /** Returns the API font family. */
354 sal_Int16
GetApiFamily() const;
355 /** Returns the API font text encoding. */
356 sal_Int16
GetApiFontEncoding() const;
357 /** Returns the API font posture. */
358 css::awt::FontSlant
GetApiPosture() const;
359 /** Returns the API font weight. */
360 float GetApiWeight() const;
361 /** Returns the API font underline style. */
362 sal_Int16
GetApiUnderline() const;
363 /** Returns the API escapement style. */
364 sal_Int16
GetApiEscapement() const;
365 /** Returns the API font strike-out style. */
366 sal_Int16
GetApiStrikeout() const;
368 /** Sets the API font height. */
369 void SetApiHeight( float fPoint
);
370 /** Sets the API font family. */
371 void SetApiFamily( sal_Int16 nApiFamily
);
372 /** Sets the API font posture. */
373 void SetApiPosture( css::awt::FontSlant eApiPosture
);
374 /** Sets the API font weight. */
375 void SetApiWeight( float fApiWeight
);
376 /** Sets the API font underline style. */
377 void SetApiUnderline( sal_Int16 nApiUnderl
);
378 /** Sets the API escapement style. */
379 void SetApiEscapement( sal_Int16 nApiEscapem
);
380 /** Sets the API font strike-out style. */
381 void SetApiStrikeout( sal_Int16 nApiStrikeout
);
384 bool operator==( const XclFontData
& rLeft
, const XclFontData
& rRight
);
386 /** Enumerates different types of Which-IDs for font items. */
387 enum class XclFontItemType
389 Cell
, /// Use Calc Which-IDs (ATTR_*).
390 Editeng
, /// Use edit engine Which-IDs (EE_CHAR_*).
391 HeaderFooter
/// Use header/footer edit engine Which-IDs (EE_CHAR_*).
394 /** Enumerates different types for objects with font settings (using different property names). */
395 enum XclFontPropSetType
397 EXC_FONTPROPSET_CHART
, /// All text objects in charts.
398 EXC_FONTPROPSET_CONTROL
/// Text formatting in form controls.
401 /** Helper class for usage of property sets. */
402 class XclFontPropSetHelper
405 explicit XclFontPropSetHelper();
407 /** Reads all font properties from the passed property set. */
408 void ReadFontProperties( XclFontData
& rFontData
,
409 const ScfPropertySet
& rPropSet
, XclFontPropSetType eType
,
410 sal_Int16 nScript
= -1 );
412 /** Writes all font properties to the passed property set, uses passed color as font color. */
413 void WriteFontProperties(
414 ScfPropertySet
& rPropSet
, XclFontPropSetType eType
,
415 const XclFontData
& rFontData
,
416 bool bHasWstrn
, bool bHasAsian
, bool bHasCmplx
,
417 const Color
* pFontColor
);
420 /** Returns a chart property set helper according to the passed script type. */
421 ScfPropSetHelper
& GetChartHelper( sal_Int16 nScript
);
424 ScfPropSetHelper maHlpChCommon
; /// Chart properties for all scripts.
425 ScfPropSetHelper maHlpChWstrn
; /// Chart properties for Western script.
426 ScfPropSetHelper maHlpChAsian
; /// Chart properties for Asian script.
427 ScfPropSetHelper maHlpChCmplx
; /// Chart properties for Complex script.
428 ScfPropSetHelper maHlpChWstrnNoName
; /// Chart properties for Western script, no font name.
429 ScfPropSetHelper maHlpChAsianNoName
; /// Chart properties for Asian script, no font name.
430 ScfPropSetHelper maHlpChCmplxNoName
; /// Chart properties for Complex script, no font name.
431 ScfPropSetHelper maHlpChEscapement
; /// Chart properties for font escapement.
432 ScfPropSetHelper maHlpControl
; /// Properties for form controls.
435 // Number formats =============================================================
439 OUString maFormat
; /// Format string, may be empty (meOffset used then).
440 NfIndexTableOffset meOffset
; /// SvNumberFormatter format index, if maFormat is empty.
441 LanguageType meLanguage
; /// Language type to be set with the number format.
444 class XclNumFmtBuffer
447 explicit XclNumFmtBuffer( const XclRoot
& rRoot
);
449 /** Returns the core index of the current standard number format. */
450 sal_uInt32
GetStdScNumFmt() const { return mnStdScNumFmt
; }
453 typedef ::std::map
< sal_uInt16
, XclNumFmt
> XclNumFmtMap
;
455 /** Clears all buffered data, used to set up for a new sheet. */
456 void InitializeImport();
458 /** Returns the current number format map. */
459 const XclNumFmtMap
& GetFormatMap() const { return maFmtMap
; }
461 /** Inserts a new number format for the specified Excel format index. */
462 void InsertFormat( sal_uInt16 nXclNumFmt
, const OUString
& rFormat
);
465 /** Inserts built-in number formats for the current system language. */
466 void InsertBuiltinFormats();
468 XclNumFmtMap maFmtMap
; /// Map containing all default and user-defined formats.
469 const LanguageType meSysLang
; /// Current system language.
470 const sal_uInt32 mnStdScNumFmt
; /// Calc format key for standard number format.
473 // Cell formatting data (XF) ==================================================
475 /** Contains all cell protection attributes. */
478 bool mbLocked
; /// true = Locked against editing.
479 bool mbHidden
; /// true = Formula is hidden.
481 explicit XclCellProt();
484 bool operator==( const XclCellProt
& rLeft
, const XclCellProt
& rRight
);
486 /** Contains all cell alignment attributes. */
489 sal_uInt8 mnHorAlign
; /// Horizontal alignment.
490 sal_uInt8 mnVerAlign
; /// Vertical alignment.
491 sal_uInt8 mnOrient
; /// Text orientation.
492 sal_uInt8 mnTextDir
; /// CTL text direction.
493 sal_uInt8 mnRotation
; /// Text rotation angle.
494 sal_uInt8 mnIndent
; /// Indentation.
495 bool mbLineBreak
; /// true = Multi-line text.
496 bool mbShrink
; /// true = Shrink to fit cell size.
498 explicit XclCellAlign();
500 /** Returns the Calc horizontal alignment. */
501 SvxCellHorJustify
GetScHorAlign() const;
502 /** Returns horizontal justification method as Calc's attribute. */
503 SvxCellJustifyMethod
GetScHorJustifyMethod() const;
504 /** Returns the Calc vertical alignment. */
505 SvxCellVerJustify
GetScVerAlign() const;
506 /** Returns vertical justification method as Calc's attribute. */
507 SvxCellJustifyMethod
GetScVerJustifyMethod() const;
508 /** Returns the Calc frame direction. */
509 SvxFrameDirection
GetScFrameDir() const;
511 /** Sets the Calc horizontal alignment. */
512 void SetScHorAlign( SvxCellHorJustify eHorJust
);
513 /** Sets the Calc vertical alignment. */
514 void SetScVerAlign( SvxCellVerJustify eVerJust
);
515 /** Sets the Calc frame direction. */
516 void SetScFrameDir( SvxFrameDirection eFrameDir
);
519 bool operator==( const XclCellAlign
& rLeft
, const XclCellAlign
& rRight
);
521 /** Contains color and line style for each cell border line. */
524 sal_uInt16 mnLeftColor
; /// Palette index for left line.
525 sal_uInt16 mnRightColor
; /// Palette index for right line.
526 sal_uInt16 mnTopColor
; /// Palette index for top line.
527 sal_uInt16 mnBottomColor
; /// Palette index for bottom line.
528 sal_uInt16 mnDiagColor
; /// Palette index for diagonal line(s).
529 sal_uInt8 mnLeftLine
; /// Style of left line.
530 sal_uInt8 mnRightLine
; /// Style of right line.
531 sal_uInt8 mnTopLine
; /// Style of top line.
532 sal_uInt8 mnBottomLine
; /// Style of bottom line.
533 sal_uInt8 mnDiagLine
; /// Style of diagonal line(s).
534 bool mbDiagTLtoBR
; /// true = Top-left to bottom-right on.
535 bool mbDiagBLtoTR
; /// true = Bottom-left to top-right on.
537 explicit XclCellBorder();
540 bool operator==( const XclCellBorder
& rLeft
, const XclCellBorder
& rRight
);
542 /** Contains background colors and pattern for a cell. */
545 sal_uInt16 mnForeColor
; /// Palette index to foreground color.
546 sal_uInt16 mnBackColor
; /// Palette index to background color.
547 sal_uInt8 mnPattern
; /// Fill pattern.
549 explicit XclCellArea();
550 explicit XclCellArea(sal_uInt8 nPattern
);
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). */
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(); }
584 /** Returns true, if this object is equal to the passed. */
585 bool Equals( const XclXFBase
& rCmp
) const;
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 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */