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