xref: /trunk/main/oox/inc/oox/xls/stylesbuffer.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef OOX_XLS_STYLESBUFFER_HXX
29 #define OOX_XLS_STYLESBUFFER_HXX
30 
31 #include <com/sun/star/awt/FontDescriptor.hpp>
32 #include <com/sun/star/table/CellHoriJustify.hpp>
33 #include <com/sun/star/table/CellOrientation.hpp>
34 #include <com/sun/star/table/CellVertJustify.hpp>
35 #include <com/sun/star/table/TableBorder.hpp>
36 #include <com/sun/star/util/CellProtection.hpp>
37 #include "oox/drawingml/color.hxx"
38 #include "oox/helper/graphichelper.hxx"
39 #include "oox/helper/refmap.hxx"
40 #include "oox/helper/refvector.hxx"
41 #include "oox/xls/numberformatsbuffer.hxx"
42 
43 namespace com { namespace sun { namespace star {
44     namespace awt { struct FontDescrtiptor; }
45 } } }
46 
47 namespace oox { class PropertySet; }
48 
49 namespace oox {
50 namespace xls {
51 
52 // ============================================================================
53 
54 const sal_Int32 OOX_COLOR_WINDOWTEXT3       = 24;       /// System window text color (BIFF3-BIFF4).
55 const sal_Int32 OOX_COLOR_WINDOWBACK3       = 25;       /// System window background color (BIFF3-BIFF4).
56 const sal_Int32 OOX_COLOR_WINDOWTEXT        = 64;       /// System window text color (BIFF5+).
57 const sal_Int32 OOX_COLOR_WINDOWBACK        = 65;       /// System window background color (BIFF5+).
58 const sal_Int32 OOX_COLOR_BUTTONBACK        = 67;       /// System button background color (face color).
59 const sal_Int32 OOX_COLOR_CHWINDOWTEXT      = 77;       /// System window text color (BIFF8 charts).
60 const sal_Int32 OOX_COLOR_CHWINDOWBACK      = 78;       /// System window background color (BIFF8 charts).
61 const sal_Int32 OOX_COLOR_CHBORDERAUTO      = 79;       /// Automatic frame border (BIFF8 charts).
62 const sal_Int32 OOX_COLOR_NOTEBACK          = 80;       /// Note background color.
63 const sal_Int32 OOX_COLOR_NOTETEXT          = 81;       /// Note text color.
64 const sal_Int32 OOX_COLOR_FONTAUTO          = 0x7FFF;   /// Font auto color (system window text color).
65 
66 // ----------------------------------------------------------------------------
67 
68 const sal_Int16 API_LINE_NONE               = 0;
69 const sal_Int16 API_LINE_HAIR               = 2;
70 const sal_Int16 API_LINE_THIN               = 35;
71 const sal_Int16 API_LINE_MEDIUM             = 88;
72 const sal_Int16 API_LINE_THICK              = 141;
73 
74 const sal_Int16 API_ESCAPE_NONE             = 0;        /// No escapement.
75 const sal_Int16 API_ESCAPE_SUPERSCRIPT      = 101;      /// Superscript: raise characters automatically (magic value 101).
76 const sal_Int16 API_ESCAPE_SUBSCRIPT        = -101;     /// Subscript: lower characters automatically (magic value -101).
77 
78 const sal_Int8 API_ESCAPEHEIGHT_NONE        = 100;      /// Relative character height if not escaped.
79 const sal_Int8 API_ESCAPEHEIGHT_DEFAULT     = 58;       /// Relative character height if escaped.
80 
81 // ============================================================================
82 
83 /** Special implementation of the GraphicHelper for Excel palette and scheme
84     colors.
85  */
86 class ExcelGraphicHelper : public GraphicHelper, public WorkbookHelper
87 {
88 public:
89     explicit            ExcelGraphicHelper( const WorkbookHelper& rHelper );
90 
91     /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
92     virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const;
93     /** Derived classes may implement to resolve a palette index to an RGB color. */
94     virtual sal_Int32   getPaletteColor( sal_Int32 nPaletteIdx ) const;
95 };
96 
97 // ============================================================================
98 
99 class Color : public ::oox::drawingml::Color
100 {
101 public:
102     /** Sets the color to automatic. */
103     void                setAuto();
104     /** Sets the color to the passed RGB value. */
105     void                setRgb( sal_Int32 nRgbValue, double fTint = 0.0 );
106     /** Sets the color to the passed theme index. */
107     void                setTheme( sal_Int32 nThemeIdx, double fTint = 0.0 );
108     /** Sets the color to the passed palette index. */
109     void                setIndexed( sal_Int32 nPaletteIdx, double fTint = 0.0 );
110 
111     /** Imports the color from the passed attribute list. */
112     void                importColor( const AttributeList& rAttribs );
113 
114     /** Imports a 64-bit color from the passed binary stream. */
115     void                importColor( SequenceInputStream& rStrm );
116     /** Imports a 32-bit palette color identifier from the passed BIFF12 stream. */
117     void                importColorId( SequenceInputStream& rStrm );
118     /** Imports a 32-bit RGBA color value from the passed BIFF12 stream. */
119     void                importColorRgb( SequenceInputStream& rStrm );
120 
121     /** Imports an 8-bit or 16-bit palette color identifier from the passed BIFF stream. */
122     void                importColorId( BiffInputStream& rStrm, bool b16Bit = true );
123     /** Imports a 32-bit RGBA color value from the passed BIFF stream. */
124     void                importColorRgb( BiffInputStream& rStrm );
125 
126     /** Returns true, if the color is set to automatic. */
127     inline bool         isAuto() const { return isPlaceHolder(); }
128 };
129 
130 // ----------------------------------------------------------------------------
131 
132 SequenceInputStream& operator>>( SequenceInputStream& rStrm, Color& orColor );
133 
134 // ============================================================================
135 
136 /** Stores all colors of the color palette. */
137 class ColorPalette : public WorkbookHelper
138 {
139 public:
140     /** Constructs the color palette with predefined color values. */
141     explicit            ColorPalette( const WorkbookHelper& rHelper );
142 
143     /** Appends a new color from the passed attributes. */
144     void                importPaletteColor( const AttributeList& rAttribs );
145     /** Appends a new color from the passed RGBCOLOR record. */
146     void                importPaletteColor( SequenceInputStream& rStrm );
147     /** Imports the PALETTE record from the passed stream. */
148     void                importPalette( BiffInputStream& rStrm );
149     /** Imports a color palette from a UNO sequence in the passed any. */
150     void                importPalette( const ::com::sun::star::uno::Any& rPalette );
151 
152     /** Rturns the RGB value of the color with the passed index. */
153     sal_Int32           getColor( sal_Int32 nPaletteIdx ) const;
154 
155 private:
156     /** Appends the passed color. */
157     void                appendColor( sal_Int32 nRGBValue );
158 
159 private:
160     ::std::vector< sal_Int32 > maColors;    /// List of RGB values.
161     size_t              mnAppendIndex;      /// Index to append a new color.
162 };
163 
164 // ============================================================================
165 
166 /** Contains all XML font attributes, e.g. from a font or rPr element. */
167 struct FontModel
168 {
169     ::rtl::OUString     maName;             /// Font name.
170     Color               maColor;            /// Font color.
171     sal_Int32           mnScheme;           /// Major/minor scheme font.
172     sal_Int32           mnFamily;           /// Font family.
173     sal_Int32           mnCharSet;          /// Windows font character set.
174     double              mfHeight;           /// Font height in points.
175     sal_Int32           mnUnderline;        /// Underline style.
176     sal_Int32           mnEscapement;       /// Escapement style.
177     bool                mbBold;             /// True = bold characters.
178     bool                mbItalic;           /// True = italic characters.
179     bool                mbStrikeout;        /// True = Strike out characters.
180     bool                mbOutline;          /// True = outlined characters.
181     bool                mbShadow;           /// True = shadowed chgaracters.
182 
183     explicit            FontModel();
184 
185     void                setBiff12Scheme( sal_uInt8 nScheme );
186     void                setBiffHeight( sal_uInt16 nHeight );
187     void                setBiffWeight( sal_uInt16 nWeight );
188     void                setBiffUnderline( sal_uInt16 nUnderline );
189     void                setBiffEscapement( sal_uInt16 nEscapement );
190 };
191 
192 // ----------------------------------------------------------------------------
193 
194 /** Enumerates different types of API font property sets. */
195 enum FontPropertyType
196 {
197     FONT_PROPTYPE_CELL,             /// Font properties in a spreadsheet cell (table::Cell service).
198     FONT_PROPTYPE_TEXT              /// Font properties in a text object (text::Text service).
199 };
200 
201 // ----------------------------------------------------------------------------
202 
203 /** Contains used flags for all API font attributes. */
204 struct ApiFontUsedFlags
205 {
206     bool                mbNameUsed;         /// True = font name/family/char set are used.
207     bool                mbColorUsed;        /// True = font color is used.
208     bool                mbSchemeUsed;       /// True = font scheme is used.
209     bool                mbHeightUsed;       /// True = font height is used.
210     bool                mbUnderlineUsed;    /// True = underline style is used.
211     bool                mbEscapementUsed;   /// True = escapement style is used.
212     bool                mbWeightUsed;       /// True = font weight (boldness) is used.
213     bool                mbPostureUsed;      /// True = font posture (italic) is used.
214     bool                mbStrikeoutUsed;    /// True = strike out style is used.
215     bool                mbOutlineUsed;      /// True = outline style is used.
216     bool                mbShadowUsed;       /// True = shadow style is used.
217 
218     explicit            ApiFontUsedFlags( bool bAllUsed );
219 };
220 
221 // ----------------------------------------------------------------------------
222 
223 /** Contains API font name, family, and charset for a script type. */
224 struct ApiScriptFontName
225 {
226     ::rtl::OUString     maName;             /// Font name.
227     sal_Int16           mnFamily;           /// Font family.
228     sal_Int16           mnTextEnc;          /// Font text encoding.
229 
230     explicit            ApiScriptFontName();
231 };
232 
233 // ----------------------------------------------------------------------------
234 
235 /** Contains all API font attributes. */
236 struct ApiFontData
237 {
238     typedef ::com::sun::star::awt::FontDescriptor ApiFontDescriptor;
239 
240     ApiScriptFontName   maLatinFont;        /// Font name for latin scripts.
241     ApiScriptFontName   maAsianFont;        /// Font name for east-asian scripts.
242     ApiScriptFontName   maCmplxFont;        /// Font name for complex scripts.
243     ApiFontDescriptor   maDesc;             /// Font descriptor (height in twips, weight in %).
244     sal_Int32           mnColor;            /// Font color.
245     sal_Int16           mnEscapement;       /// Escapement style.
246     sal_Int8            mnEscapeHeight;     /// Escapement font height.
247     bool                mbOutline;          /// True = outlined characters.
248     bool                mbShadow;           /// True = shadowed chgaracters.
249 
250     explicit            ApiFontData();
251 };
252 
253 // ============================================================================
254 
255 class Font : public WorkbookHelper
256 {
257 public:
258     explicit            Font( const WorkbookHelper& rHelper, bool bDxf );
259     explicit            Font( const WorkbookHelper& rHelper, const FontModel& rModel );
260 
261     /** Sets font formatting attributes for the passed element. */
262     void                importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
263 
264     /** Imports the FONT record from the passed stream. */
265     void                importFont( SequenceInputStream& rStrm );
266     /** Imports the font name from a DXF record. */
267     void                importDxfName( SequenceInputStream& rStrm );
268     /** Imports the font color from a DXF record. */
269     void                importDxfColor( SequenceInputStream& rStrm );
270     /** Imports the font scheme from a DXF record. */
271     void                importDxfScheme( SequenceInputStream& rStrm );
272     /** Imports the font height from a DXF record. */
273     void                importDxfHeight( SequenceInputStream& rStrm );
274     /** Imports the font weight from a DXF record. */
275     void                importDxfWeight( SequenceInputStream& rStrm );
276     /** Imports the font underline style from a DXF record. */
277     void                importDxfUnderline( SequenceInputStream& rStrm );
278     /** Imports the font escapement style from a DXF record. */
279     void                importDxfEscapement( SequenceInputStream& rStrm );
280     /** Imports a font style flag from a DXF record. */
281     void                importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm );
282 
283     /** Imports the FONT record from the passed stream. */
284     void                importFont( BiffInputStream& rStrm );
285     /** Imports the FONTCOLOR record from the passed stream. */
286     void                importFontColor( BiffInputStream& rStrm );
287     /** Sets the font attributes from the font block of a CFRULE record. */
288     void                importCfRule( BiffInputStream& rStrm );
289 
290     /** Returns the font model structure. This function can be called before
291         finalizeImport() has been called. */
292     inline const FontModel& getModel() const { return maModel; }
293     /** Returns the text encoding for strings used with this font. This
294         function can be called before finalizeImport() has been called. */
295     rtl_TextEncoding    getFontEncoding() const;
296 
297     /** Final processing after import of all style settings. */
298     void                finalizeImport();
299 
300     /** Returns an API font descriptor with own font information. */
301     const ::com::sun::star::awt::FontDescriptor& getFontDescriptor() const;
302     /** Returns true, if the font requires rich text formatting in Calc.
303         @descr  Example: Font escapement is a cell attribute in Excel, but Calc
304         needs an rich text cell for this attribute. */
305     bool                needsRichTextFormat() const;
306 
307     /** Writes all font attributes to the passed property map. */
308     void                writeToPropertyMap(
309                             PropertyMap& rPropMap,
310                             FontPropertyType ePropType ) const;
311     /** Writes all font attributes to the passed property set. */
312     void                writeToPropertySet(
313                             PropertySet& rPropSet,
314                             FontPropertyType ePropType ) const;
315 
316 private:
317     /** Reads and sets height and flags. */
318     void                importFontData2( BiffInputStream& rStrm );
319     /** Reads and sets weight, escapement, underline, family, charset (BIFF5+). */
320     void                importFontData5( BiffInputStream& rStrm );
321 
322     /** Reads and sets a byte string as font name. */
323     void                importFontName2( BiffInputStream& rStrm );
324     /** Reads and sets a Unicode string as font name. */
325     void                importFontName8( BiffInputStream& rStrm );
326 
327 private:
328     FontModel           maModel;
329     ApiFontData         maApiData;
330     ApiFontUsedFlags    maUsedFlags;
331     bool                mbDxf;
332 };
333 
334 typedef ::boost::shared_ptr< Font > FontRef;
335 
336 // ============================================================================
337 
338 /** Contains all XML cell alignment attributes, e.g. from an alignment element. */
339 struct AlignmentModel
340 {
341     sal_Int32           mnHorAlign;         /// Horizontal alignment.
342     sal_Int32           mnVerAlign;         /// Vertical alignment.
343     sal_Int32           mnTextDir;          /// CTL text direction.
344     sal_Int32           mnRotation;         /// Text rotation angle.
345     sal_Int32           mnIndent;           /// Indentation.
346     bool                mbWrapText;         /// True = multi-line text.
347     bool                mbShrink;           /// True = shrink to fit cell size.
348     bool                mbJustLastLine;     /// True = justify last line in block text.
349 
350     explicit            AlignmentModel();
351 
352     /** Sets horizontal alignment from the passed BIFF data. */
353     void                setBiffHorAlign( sal_uInt8 nHorAlign );
354     /** Sets vertical alignment from the passed BIFF data. */
355     void                setBiffVerAlign( sal_uInt8 nVerAlign );
356     /** Sets rotation from the passed BIFF text orientation. */
357     void                setBiffTextOrient( sal_uInt8 nTextOrient );
358 };
359 
360 // ----------------------------------------------------------------------------
361 
362 /** Contains all API cell alignment attributes. */
363 struct ApiAlignmentData
364 {
365     typedef ::com::sun::star::table::CellHoriJustify ApiCellHoriJustify;
366     typedef ::com::sun::star::table::CellVertJustify ApiCellVertJustify;
367     typedef ::com::sun::star::table::CellOrientation ApiCellOrientation;
368 
369     ApiCellHoriJustify  meHorJustify;       /// Horizontal alignment.
370     ApiCellVertJustify  meVerJustify;       /// Vertical alignment.
371     ApiCellOrientation  meOrientation;      /// Normal or stacked text.
372     sal_Int32           mnRotation;         /// Text rotation angle.
373     sal_Int16           mnWritingMode;      /// CTL text direction.
374     sal_Int16           mnIndent;           /// Indentation.
375     bool                mbWrapText;         /// True = multi-line text.
376     bool                mbShrink;           /// True = shrink to fit cell size.
377 
378     explicit            ApiAlignmentData();
379 };
380 
381 bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight );
382 
383 // ============================================================================
384 
385 class Alignment : public WorkbookHelper
386 {
387 public:
388     explicit            Alignment( const WorkbookHelper& rHelper );
389 
390     /** Sets all attributes from the alignment element. */
391     void                importAlignment( const AttributeList& rAttribs );
392 
393     /** Sets the alignment attributes from the passed BIFF12 XF record data. */
394     void                setBiff12Data( sal_uInt32 nFlags );
395     /** Sets the alignment attributes from the passed BIFF2 XF record data. */
396     void                setBiff2Data( sal_uInt8 nFlags );
397     /** Sets the alignment attributes from the passed BIFF3 XF record data. */
398     void                setBiff3Data( sal_uInt16 nAlign );
399     /** Sets the alignment attributes from the passed BIFF4 XF record data. */
400     void                setBiff4Data( sal_uInt16 nAlign );
401     /** Sets the alignment attributes from the passed BIFF5 XF record data. */
402     void                setBiff5Data( sal_uInt16 nAlign );
403     /** Sets the alignment attributes from the passed BIFF8 XF record data. */
404     void                setBiff8Data( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib );
405 
406     /** Final processing after import of all style settings. */
407     void                finalizeImport();
408 
409     /** Returns the alignment model structure. */
410     inline const AlignmentModel& getModel() const { return maModel; }
411     /** Returns the converted API alignment data struct. */
412     inline const ApiAlignmentData& getApiData() const { return maApiData; }
413 
414     /** Writes all alignment attributes to the passed property map. */
415     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
416 
417 private:
418     AlignmentModel      maModel;            /// Alignment model data.
419     ApiAlignmentData    maApiData;          /// Alignment data converted to API constants.
420 };
421 
422 typedef ::boost::shared_ptr< Alignment > AlignmentRef;
423 
424 // ============================================================================
425 
426 /** Contains all XML cell protection attributes, e.g. from a protection element. */
427 struct ProtectionModel
428 {
429     bool                mbLocked;           /// True = locked against editing.
430     bool                mbHidden;           /// True = formula is hidden.
431 
432     explicit            ProtectionModel();
433 };
434 
435 // ----------------------------------------------------------------------------
436 
437 /** Contains all API cell protection attributes. */
438 struct ApiProtectionData
439 {
440     typedef ::com::sun::star::util::CellProtection ApiCellProtection;
441 
442     ApiCellProtection   maCellProt;
443 
444     explicit            ApiProtectionData();
445 };
446 
447 bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight );
448 
449 // ============================================================================
450 
451 class Protection : public WorkbookHelper
452 {
453 public:
454     explicit            Protection( const WorkbookHelper& rHelper );
455 
456     /** Sets all attributes from the protection element. */
457     void                importProtection( const AttributeList& rAttribs );
458 
459     /** Sets the protection attributes from the passed BIFF12 XF record data. */
460     void                setBiff12Data( sal_uInt32 nFlags );
461     /** Sets the protection attributes from the passed BIFF2 XF record data. */
462     void                setBiff2Data( sal_uInt8 nNumFmt );
463     /** Sets the protection attributes from the passed BIFF3-BIFF8 XF record data. */
464     void                setBiff3Data( sal_uInt16 nProt );
465 
466     /** Final processing after import of all style settings. */
467     void                finalizeImport();
468 
469     /** Returns the protection model structure. */
470     inline const ProtectionModel& getModel() const { return maModel; }
471     /** Returns the converted API protection data struct. */
472     inline const ApiProtectionData& getApiData() const { return maApiData; }
473 
474     /** Writes all protection attributes to the passed property map. */
475     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
476 
477 private:
478     ProtectionModel     maModel;            /// Protection model data.
479     ApiProtectionData   maApiData;          /// Protection data converted to API constants.
480 };
481 
482 typedef ::boost::shared_ptr< Protection > ProtectionRef;
483 
484 // ============================================================================
485 
486 /** Contains XML attributes of a single border line. */
487 struct BorderLineModel
488 {
489     Color               maColor;            /// Borderline color.
490     sal_Int32           mnStyle;            /// Border line style.
491     bool                mbUsed;             /// True = line format used.
492 
493     explicit            BorderLineModel( bool bDxf );
494 
495     /** Sets the passed BIFF line style. */
496     void                setBiffStyle( sal_Int32 nLineStyle );
497     /** Sets line style and line color from the passed BIFF data. */
498     void                setBiffData( sal_uInt8 nLineStyle, sal_uInt16 nLineColor );
499 };
500 
501 // ----------------------------------------------------------------------------
502 
503 /** Contains XML attributes of a complete cell border. */
504 struct BorderModel
505 {
506     BorderLineModel     maLeft;             /// Left line format.
507     BorderLineModel     maRight;            /// Right line format.
508     BorderLineModel     maTop;              /// Top line format.
509     BorderLineModel     maBottom;           /// Bottom line format.
510     BorderLineModel     maDiagonal;         /// Diagonal line format.
511     bool                mbDiagTLtoBR;       /// True = top-left to bottom-right on.
512     bool                mbDiagBLtoTR;       /// True = bottom-left to top-right on.
513 
514     explicit            BorderModel( bool bDxf );
515 };
516 
517 // ----------------------------------------------------------------------------
518 
519 /** Contains API attributes of a complete cell border. */
520 struct ApiBorderData
521 {
522     typedef ::com::sun::star::table::TableBorder    ApiTableBorder;
523     typedef ::com::sun::star::table::BorderLine     ApiBorderLine;
524 
525     ApiTableBorder      maBorder;           /// Left/right/top/bottom line format.
526     ApiBorderLine       maTLtoBR;           /// Diagonal top-left to bottom-right line format.
527     ApiBorderLine       maBLtoTR;           /// Diagonal bottom-left to top-right line format.
528     bool                mbBorderUsed;       /// True = left/right/top/bottom line format used.
529     bool                mbDiagUsed;         /// True = diagonal line format used.
530 
531     explicit            ApiBorderData();
532 
533     /** Returns true, if any of the outer border lines is visible. */
534     bool                hasAnyOuterBorder() const;
535 };
536 
537 bool operator==( const ApiBorderData& rLeft, const ApiBorderData& rRight );
538 
539 // ============================================================================
540 
541 class Border : public WorkbookHelper
542 {
543 public:
544     explicit            Border( const WorkbookHelper& rHelper, bool bDxf );
545 
546     /** Sets global border attributes from the border element. */
547     void                importBorder( const AttributeList& rAttribs );
548     /** Sets border attributes for the border line with the passed element identifier. */
549     void                importStyle( sal_Int32 nElement, const AttributeList& rAttribs );
550     /** Sets color attributes for the border line with the passed element identifier. */
551     void                importColor( sal_Int32 nElement, const AttributeList& rAttribs );
552 
553     /** Imports the BORDER record from the passed stream. */
554     void                importBorder( SequenceInputStream& rStrm );
555     /** Imports a border from a DXF record from the passed stream. */
556     void                importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm );
557 
558     /** Sets the border attributes from the passed BIFF2 XF record data. */
559     void                setBiff2Data( sal_uInt8 nFlags );
560     /** Sets the border attributes from the passed BIFF3/BIFF4 XF record data. */
561     void                setBiff3Data( sal_uInt32 nBorder );
562     /** Sets the border attributes from the passed BIFF5 XF record data. */
563     void                setBiff5Data( sal_uInt32 nBorder, sal_uInt32 nArea );
564     /** Sets the border attributes from the passed BIFF8 XF record data. */
565     void                setBiff8Data( sal_uInt32 nBorder1, sal_uInt32 nBorder2 );
566     /** Sets the border attributes from the border block of a CFRULE record. */
567     void                importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags );
568 
569     /** Final processing after import of all style settings. */
570     void                finalizeImport();
571 
572     /** Returns the border model structure. */
573     inline const BorderModel& getModel() const { return maModel; }
574     /** Returns the converted API border data struct. */
575     inline const ApiBorderData& getApiData() const { return maApiData; }
576 
577     /** Writes all border attributes to the passed property map. */
578     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
579 
580 private:
581     /** Returns the border line struct specified by the passed XML token identifier. */
582     BorderLineModel*    getBorderLine( sal_Int32 nElement );
583 
584     /** Converts border line data to an API struct, returns true, if the line is marked as used. */
585     bool                convertBorderLine(
586                             ::com::sun::star::table::BorderLine& rBorderLine,
587                             const BorderLineModel& rModel );
588 
589 private:
590     BorderModel         maModel;
591     ApiBorderData       maApiData;
592     bool                mbDxf;
593 };
594 
595 typedef ::boost::shared_ptr< Border > BorderRef;
596 
597 // ============================================================================
598 
599 /** Contains XML pattern fill attributes from the patternFill element. */
600 struct PatternFillModel
601 {
602     Color               maPatternColor;     /// Pattern foreground color.
603     Color               maFillColor;        /// Background fill color.
604     sal_Int32           mnPattern;          /// Pattern identifier (e.g. solid).
605     bool                mbPattColorUsed;    /// True = pattern foreground color used.
606     bool                mbFillColorUsed;    /// True = background fill color used.
607     bool                mbPatternUsed;      /// True = pattern used.
608 
609     explicit            PatternFillModel( bool bDxf );
610 
611     /** Sets the passed BIFF pattern identifier. */
612     void                setBiffPattern( sal_Int32 nPattern );
613     /** Sets the pattern and pattern colors from the passed BIFF data. */
614     void                setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFillColor, sal_uInt8 nPattern );
615 };
616 
617 // ----------------------------------------------------------------------------
618 
619 /** Contains XML gradient fill attributes from the gradientFill element. */
620 struct GradientFillModel
621 {
622     typedef ::std::map< double, Color > ColorMap;
623 
624     sal_Int32           mnType;             /// Gradient type, linear or path.
625     double              mfAngle;            /// Rotation angle for type linear.
626     double              mfLeft;             /// Left convergence for type path.
627     double              mfRight;            /// Right convergence for type path.
628     double              mfTop;              /// Top convergence for type path.
629     double              mfBottom;           /// Bottom convergence for type path.
630     ColorMap            maColors;           /// Gradient colors.
631 
632     explicit            GradientFillModel();
633 
634     /** Reads BIFF12 gradient settings from a FILL or DXF record. */
635     void                readGradient( SequenceInputStream& rStrm );
636     /** Reads BIFF12 gradient stop settings from a FILL or DXF record. */
637     void                readGradientStop( SequenceInputStream& rStrm, bool bDxf );
638 };
639 
640 // ----------------------------------------------------------------------------
641 
642 /** Contains API fill attributes. */
643 struct ApiSolidFillData
644 {
645     sal_Int32           mnColor;            /// Fill color.
646     bool                mbTransparent;      /// True = transparent area.
647     bool                mbUsed;             /// True = fill data is valid.
648 
649     explicit            ApiSolidFillData();
650 };
651 
652 bool operator==( const ApiSolidFillData& rLeft, const ApiSolidFillData& rRight );
653 
654 // ============================================================================
655 
656 /** Contains cell fill attributes, either a pattern fill or a gradient fill. */
657 class Fill : public WorkbookHelper
658 {
659 public:
660     explicit            Fill( const WorkbookHelper& rHelper, bool bDxf );
661 
662     /** Sets attributes of a patternFill element. */
663     void                importPatternFill( const AttributeList& rAttribs );
664     /** Sets the pattern color from the fgColor element. */
665     void                importFgColor( const AttributeList& rAttribs );
666     /** Sets the background color from the bgColor element. */
667     void                importBgColor( const AttributeList& rAttribs );
668     /** Sets attributes of a gradientFill element. */
669     void                importGradientFill( const AttributeList& rAttribs );
670     /** Sets a color from the color element in a gradient fill. */
671     void                importColor( const AttributeList& rAttribs, double fPosition );
672 
673     /** Imports the FILL record from the passed stream. */
674     void                importFill( SequenceInputStream& rStrm );
675     /** Imports the fill pattern from a DXF record. */
676     void                importDxfPattern( SequenceInputStream& rStrm );
677     /** Imports the pattern color from a DXF record. */
678     void                importDxfFgColor( SequenceInputStream& rStrm );
679     /** Imports the background color from a DXF record. */
680     void                importDxfBgColor( SequenceInputStream& rStrm );
681     /** Imports gradient settings from a DXF record. */
682     void                importDxfGradient( SequenceInputStream& rStrm );
683     /** Imports gradient stop settings from a DXF record. */
684     void                importDxfStop( SequenceInputStream& rStrm );
685 
686     /** Sets the fill attributes from the passed BIFF2 XF record data. */
687     void                setBiff2Data( sal_uInt8 nFlags );
688     /** Sets the fill attributes from the passed BIFF3/BIFF4 XF record data. */
689     void                setBiff3Data( sal_uInt16 nArea );
690     /** Sets the fill attributes from the passed BIFF5 XF record data. */
691     void                setBiff5Data( sal_uInt32 nArea );
692     /** Sets the fill attributes from the passed BIFF8 XF record data. */
693     void                setBiff8Data( sal_uInt32 nBorder2, sal_uInt16 nArea );
694     /** Sets the fill attributes from the fill block of a CFRULE record. */
695     void                importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags );
696 
697     /** Final processing after import of all style settings. */
698     void                finalizeImport();
699 
700     /** Returns the fill pattern model structure, if extant. */
701     inline const PatternFillModel* getPatternModel() const { return mxPatternModel.get(); }
702     /** Returns the fill gradient model structure, if extant. */
703     inline const GradientFillModel* getGradientModel() const { return mxGradientModel.get(); }
704     /** Returns the converted API fill data struct. */
705     inline const ApiSolidFillData& getApiData() const { return maApiData; }
706 
707     /** Writes all fill attributes to the passed property map. */
708     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
709 
710 private:
711     typedef ::boost::shared_ptr< PatternFillModel >   PatternModelRef;
712     typedef ::boost::shared_ptr< GradientFillModel >  GradientModelRef;
713 
714     PatternModelRef     mxPatternModel;
715     GradientModelRef    mxGradientModel;
716     ApiSolidFillData    maApiData;
717     bool                mbDxf;
718 };
719 
720 typedef ::boost::shared_ptr< Fill > FillRef;
721 
722 // ============================================================================
723 
724 /** Contains all data for a cell format or cell style. */
725 struct XfModel
726 {
727     sal_Int32           mnStyleXfId;        /// Index to parent style XF.
728     sal_Int32           mnFontId;           /// Index to font data list.
729     sal_Int32           mnNumFmtId;         /// Index to number format list.
730     sal_Int32           mnBorderId;         /// Index to list of cell borders.
731     sal_Int32           mnFillId;           /// Index to list of cell areas.
732     bool                mbCellXf;           /// True = cell XF, false = style XF.
733     bool                mbFontUsed;         /// True = font index used.
734     bool                mbNumFmtUsed;       /// True = number format used.
735     bool                mbAlignUsed;        /// True = alignment used.
736     bool                mbProtUsed;         /// True = cell protection used.
737     bool                mbBorderUsed;       /// True = border data used.
738     bool                mbAreaUsed;         /// True = area data used.
739 
740     explicit            XfModel();
741 };
742 
743 // ============================================================================
744 
745 /** Represents a cell format or a cell style (called XF, extended format).
746 
747     This class stores the type (cell/style), the index to the parent style (if
748     it is a cell format) and all "attribute used" flags, which reflect the
749     state of specific attribute groups (true = user has changed the attributes)
750     and all formatting data.
751  */
752 class Xf : public WorkbookHelper
753 {
754 public:
755     explicit            Xf( const WorkbookHelper& rHelper );
756 
757     /** Sets all "attribute used" flags to the passed state. */
758     void                setAllUsedFlags( bool bUsed );
759 
760     /** Sets all attributes from the xf element. */
761     void                importXf( const AttributeList& rAttribs, bool bCellXf );
762     /** Sets all attributes from the alignment element. */
763     void                importAlignment( const AttributeList& rAttribs );
764     /** Sets all attributes from the protection element. */
765     void                importProtection( const AttributeList& rAttribs );
766 
767     /** Imports the XF record from the passed stream. */
768     void                importXf( SequenceInputStream& rStrm, bool bCellXf );
769 
770     /** Imports the XF record from the passed stream. */
771     void                importXf( BiffInputStream& rStrm );
772 
773     /** Final processing after import of all style settings. */
774     void                finalizeImport();
775 
776     /** Returns true, if the XF is a cell XF, and false, if it is a style XF. */
777     inline bool         isCellXf() const { return maModel.mbCellXf; }
778 
779     /** Returns the referred font object. */
780     FontRef             getFont() const;
781     /** Returns the alignment data of this style. */
782     inline const Alignment& getAlignment() const { return maAlignment; }
783     /** Returns the cell protection data of this style. */
784     inline const Protection& getProtection() const { return maProtection; }
785     /** Returns true, if any "attribute used" flags are ste in this XF. */
786     bool                hasAnyUsedFlags() const;
787 
788     /** Writes all formatting attributes to the passed property map. */
789     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
790     /** Writes all formatting attributes to the passed property set. */
791     void                writeToPropertySet( PropertySet& rPropSet ) const;
792 
793     /** Converts formatting information from BIFF2 cell record data directly. */
794     static void         writeBiff2CellFormatToPropertySet(
795                             const WorkbookHelper& rHelper, PropertySet& rPropSet,
796                             sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 );
797 
798 private:
799     /** Sets 'attribute used' flags from the passed BIFF bit field. */
800     void                setBiffUsedFlags( sal_uInt8 nUsedFlags );
801 
802 private:
803     XfModel             maModel;            /// Cell XF or style XF model data.
804     Alignment           maAlignment;        /// Cell alignment data.
805     Protection          maProtection;       /// Cell protection data.
806     ::com::sun::star::table::CellVertJustify
807                         meRotationRef;      /// Rotation reference dependent on border.
808 };
809 
810 typedef ::boost::shared_ptr< Xf > XfRef;
811 
812 // ============================================================================
813 
814 class Dxf : public WorkbookHelper
815 {
816 public:
817     explicit            Dxf( const WorkbookHelper& rHelper );
818 
819     /** Creates a new empty font object. */
820     FontRef             createFont( bool bAlwaysNew = true );
821     /** Creates a new empty border object. */
822     BorderRef           createBorder( bool bAlwaysNew = true );
823     /** Creates a new empty fill object. */
824     FillRef             createFill( bool bAlwaysNew = true );
825 
826     /** Inserts a new number format code. */
827     void                importNumFmt( const AttributeList& rAttribs );
828     /** Sets all attributes from the alignment element. */
829     void                importAlignment( const AttributeList& rAttribs );
830     /** Sets all attributes from the protection element. */
831     void                importProtection( const AttributeList& rAttribs );
832 
833     /** Imports the DXF record from the passed stream. */
834     void                importDxf( SequenceInputStream& rStrm );
835 
836     /** Imports font, border, and fill settings from the CFRULE record. */
837     void                importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags );
838 
839     /** Final processing after import of all style settings. */
840     void                finalizeImport();
841 
842     /** Writes all formatting attributes to the passed property map. */
843     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
844     /** Writes all formatting attributes to the passed property set. */
845     void                writeToPropertySet( PropertySet& rPropSet ) const;
846 
847 private:
848     FontRef             mxFont;             /// Font data.
849     NumberFormatRef     mxNumFmt;           /// Number format data.
850     AlignmentRef        mxAlignment;        /// Alignment data.
851     ProtectionRef       mxProtection;       /// Protection data.
852     BorderRef           mxBorder;           /// Border data.
853     FillRef             mxFill;             /// Fill data.
854 };
855 
856 typedef ::boost::shared_ptr< Dxf > DxfRef;
857 
858 // ============================================================================
859 
860 /** Contains attributes of a cell style, e.g. from the cellStyle element. */
861 struct CellStyleModel
862 {
863     ::rtl::OUString     maName;             /// Cell style name.
864     sal_Int32           mnXfId;             /// Formatting for this cell style.
865     sal_Int32           mnBuiltinId;        /// Identifier for builtin styles.
866     sal_Int32           mnLevel;            /// Level for builtin column/row styles.
867     bool                mbBuiltin;          /// True = builtin style.
868     bool                mbCustom;           /// True = customized builtin style.
869     bool                mbHidden;           /// True = style not visible in GUI.
870 
871     explicit            CellStyleModel();
872 
873     /** Returns true, if this style is a builtin style. */
874     bool                isBuiltin() const;
875     /** Returns true, if this style represents the default document cell style. */
876     bool                isDefaultStyle() const;
877 };
878 
879 // ============================================================================
880 
881 class CellStyle : public WorkbookHelper
882 {
883 public:
884     explicit            CellStyle( const WorkbookHelper& rHelper );
885 
886     /** Imports passed attributes from the cellStyle element. */
887     void                importCellStyle( const AttributeList& rAttribs );
888     /** Imports style settings from a CELLSTYLE record. */
889     void                importCellStyle( SequenceInputStream& rStrm );
890     /** Imports style settings from a STYLE record. */
891     void                importStyle( BiffInputStream& rStrm );
892 
893     /** Creates the style sheet in the document described by this cell style object. */
894     void                createCellStyle();
895     /** Stores tha passed final style name and creates the cell style, if it is
896         user-defined or modified built-in. */
897     void                finalizeImport( const ::rtl::OUString& rFinalName );
898 
899     /** Returns the cell style model structure. */
900     inline const CellStyleModel& getModel() const { return maModel; }
901     /** Returns the final style name used in the document. */
902     inline const ::rtl::OUString& getFinalStyleName() const { return maFinalName; }
903 
904 private:
905     CellStyleModel      maModel;
906     ::rtl::OUString     maFinalName;        /// Final style name used in API.
907     bool                mbCreated;          /// True = style sheet created.
908 };
909 
910 typedef ::boost::shared_ptr< CellStyle > CellStyleRef;
911 
912 // ============================================================================
913 
914 class CellStyleBuffer : public WorkbookHelper
915 {
916 public:
917     explicit            CellStyleBuffer( const WorkbookHelper& rHelper );
918 
919     /** Appends and returns a new named cell style object. */
920     CellStyleRef        importCellStyle( const AttributeList& rAttribs );
921     /** Imports the CELLSTYLE record from the passed stream. */
922     CellStyleRef        importCellStyle( SequenceInputStream& rStrm );
923     /** Imports the STYLE record from the passed stream. */
924     CellStyleRef        importStyle( BiffInputStream& rStrm );
925 
926     /** Final processing after import of all style settings. */
927     void                finalizeImport();
928 
929     /** Returns the XF identifier associated to the default cell style. */
930     sal_Int32           getDefaultXfId() const;
931     /** Returns the default style sheet for unused cells. */
932     ::rtl::OUString     getDefaultStyleName() const;
933     /** Creates the style sheet described by the style XF with the passed identifier. */
934     ::rtl::OUString     createCellStyle( sal_Int32 nXfId ) const;
935 
936 private:
937     /** Inserts the passed cell style object into the internal maps. */
938     void                insertCellStyle( CellStyleRef xCellStyle );
939     /** Creates the style sheet described by the passed cell style object. */
940     ::rtl::OUString     createCellStyle( const CellStyleRef& rxCellStyle ) const;
941 
942 private:
943     typedef RefVector< CellStyle >          CellStyleVector;
944     typedef RefMap< sal_Int32, CellStyle >  CellStyleXfIdMap;
945 
946     CellStyleVector     maBuiltinStyles;    /// All built-in cell styles.
947     CellStyleVector     maUserStyles;       /// All user defined cell styles.
948     CellStyleXfIdMap    maStylesByXf;       /// All cell styles, mapped by XF identifier.
949     CellStyleRef        mxDefStyle;         /// Default cell style.
950 };
951 
952 // ============================================================================
953 
954 struct AutoFormatModel
955 {
956     sal_Int32           mnAutoFormatId;     /// Index of predefined autoformatting.
957     bool                mbApplyNumFmt;      /// True = apply number format from autoformatting.
958     bool                mbApplyFont;        /// True = apply font from autoformatting.
959     bool                mbApplyAlignment;   /// True = apply alignment from autoformatting.
960     bool                mbApplyBorder;      /// True = apply border from autoformatting.
961     bool                mbApplyFill;        /// True = apply fill from autoformatting.
962     bool                mbApplyProtection;  /// True = apply protection from autoformatting.
963 
964     explicit            AutoFormatModel();
965 };
966 
967 // ============================================================================
968 
969 class StylesBuffer : public WorkbookHelper
970 {
971 public:
972     explicit            StylesBuffer( const WorkbookHelper& rHelper );
973 
974     /** Creates a new empty font object.
975         @param opnFontId  (out-param) The identifier of the new font object. */
976     FontRef             createFont( sal_Int32* opnFontId = 0 );
977     /** Creates a number format. */
978     NumberFormatRef     createNumFmt( sal_Int32 nNumFmtId, const ::rtl::OUString& rFmtCode );
979     /** Creates a new empty border object.
980         @param opnBorderId  (out-param) The identifier of the new border object. */
981     BorderRef           createBorder( sal_Int32* opnBorderId = 0 );
982     /** Creates a new empty fill object.
983         @param opnFillId  (out-param) The identifier of the new fill object. */
984     FillRef             createFill( sal_Int32* opnFillId = 0 );
985     /** Creates a new empty cell formatting object.
986         @param opnXfId  (out-param) The identifier of the new XF object. */
987     XfRef               createCellXf( sal_Int32* opnXfId = 0 );
988     /** Creates a new empty style formatting object.
989         @param opnXfId  (out-param) The identifier of the new XF object. */
990     XfRef               createStyleXf( sal_Int32* opnXfId = 0 );
991     /** Creates a new empty differential formatting object.
992         @param opnDxfId  (out-param) The identifier of the new DXF object. */
993     DxfRef              createDxf( sal_Int32* opnDxfId = 0 );
994 
995     /** Appends a new color to the color palette. */
996     void                importPaletteColor( const AttributeList& rAttribs );
997     /** Inserts a new number format code. */
998     NumberFormatRef     importNumFmt( const AttributeList& rAttribs );
999     /** Appends and returns a new named cell style object. */
1000     CellStyleRef        importCellStyle( const AttributeList& rAttribs );
1001 
1002     /** Appends a new color to the color palette. */
1003     void                importPaletteColor( SequenceInputStream& rStrm );
1004     /** Imports the NUMFMT record from the passed stream. */
1005     void                importNumFmt( SequenceInputStream& rStrm );
1006     /** Imports the CELLSTYLE record from the passed stream. */
1007     void                importCellStyle( SequenceInputStream& rStrm );
1008 
1009     /** Imports the PALETTE record from the passed stream. */
1010     void                importPalette( BiffInputStream& rStrm );
1011     /** Imports the FONT record from the passed stream. */
1012     void                importFont( BiffInputStream& rStrm );
1013     /** Imports the FONTCOLOR record from the passed stream. */
1014     void                importFontColor( BiffInputStream& rStrm );
1015     /** Imports the FORMAT record from the passed stream. */
1016     void                importFormat( BiffInputStream& rStrm );
1017     /** Imports the XF record from the passed stream. */
1018     void                importXf( BiffInputStream& rStrm );
1019     /** Imports the STYLE record from the passed stream. */
1020     void                importStyle( BiffInputStream& rStrm );
1021 
1022     /** Imports a color palette from a UNO sequence in the passed any. */
1023     void                importPalette( const ::com::sun::star::uno::Any& rPalette );
1024 
1025     /** Final processing after import of all style settings. */
1026     void                finalizeImport();
1027 
1028     /** Returns the palette color with the specified index. */
1029     sal_Int32           getPaletteColor( sal_Int32 nIndex ) const;
1030     /** Returns the specified font object. */
1031     FontRef             getFont( sal_Int32 nFontId ) const;
1032     /** Returns the specified border object. */
1033     BorderRef           getBorder( sal_Int32 nBorderId ) const;
1034     /** Returns the specified cell format object. */
1035     XfRef               getCellXf( sal_Int32 nXfId ) const;
1036     /** Returns the specified style format object. */
1037     XfRef               getStyleXf( sal_Int32 nXfId ) const;
1038     /** Returns the specified diferential cell format object. */
1039     DxfRef              getDxf( sal_Int32 nDxfId ) const;
1040 
1041     /** Returns the font object of the specified cell XF. */
1042     FontRef             getFontFromCellXf( sal_Int32 nXfId ) const;
1043     /** Returns the default application font (used in the "Normal" cell style). */
1044     FontRef             getDefaultFont() const;
1045     /** Returns the model of the default application font (used in the "Normal" cell style). */
1046     const FontModel&    getDefaultFontModel() const;
1047 
1048     /** Returns true, if the specified borders are equal. */
1049     bool                equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) const;
1050     /** Returns true, if the specified fills are equal. */
1051     bool                equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const;
1052 
1053     /** Returns the default style sheet for unused cells. */
1054     ::rtl::OUString     getDefaultStyleName() const;
1055     /** Creates the style sheet described by the style XF with the passed identifier. */
1056     ::rtl::OUString     createCellStyle( sal_Int32 nXfId ) const;
1057     /** Creates the style sheet described by the DXF with the passed identifier. */
1058     ::rtl::OUString     createDxfStyle( sal_Int32 nDxfId ) const;
1059 
1060     /** Writes the font attributes of the specified font data to the passed property map. */
1061     void                writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFontId ) const;
1062     /** Writes the specified number format to the passed property map. */
1063     void                writeNumFmtToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const;
1064     /** Writes the border attributes of the specified border data to the passed property map. */
1065     void                writeBorderToPropertyMap( PropertyMap& rPropMap, sal_Int32 nBorderId ) const;
1066     /** Writes the fill attributes of the specified fill data to the passed property map. */
1067     void                writeFillToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFillId ) const;
1068     /** Writes the cell formatting attributes of the specified XF to the passed property map. */
1069     void                writeCellXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const;
1070     /** Writes the cell formatting attributes of the specified style XF to the passed property map. */
1071     void                writeStyleXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const;
1072 
1073     /** Writes the cell formatting attributes of the specified XF to the passed property set. */
1074     void                writeCellXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const;
1075     /** Writes the cell formatting attributes of the specified style XF to the passed property set. */
1076     void                writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const;
1077 
1078 private:
1079     typedef RefVector< Font >                           FontVector;
1080     typedef RefVector< Border >                         BorderVector;
1081     typedef RefVector< Fill >                           FillVector;
1082     typedef RefVector< Xf >                             XfVector;
1083     typedef RefVector< Dxf >                            DxfVector;
1084     typedef ::std::map< sal_Int32, ::rtl::OUString >    DxfStyleMap;
1085 
1086     ColorPalette        maPalette;          /// Color palette.
1087     FontVector          maFonts;            /// List of font objects.
1088     NumberFormatsBuffer maNumFmts;          /// List of all number format codes.
1089     BorderVector        maBorders;          /// List of cell border objects.
1090     FillVector          maFills;            /// List of cell area fill objects.
1091     XfVector            maCellXfs;          /// List of cell formats.
1092     XfVector            maStyleXfs;         /// List of cell styles.
1093     CellStyleBuffer     maCellStyles;       /// All built-in and user defined cell styles.
1094     DxfVector           maDxfs;             /// List of differential cell styles.
1095     mutable DxfStyleMap maDxfStyles;        /// Maps DXF identifiers to Calc style sheet names.
1096 };
1097 
1098 // ============================================================================
1099 
1100 } // namespace xls
1101 } // namespace oox
1102 
1103 #endif
1104