xref: /trunk/main/sc/source/filter/inc/xetable.hxx (revision 38d50f7b)
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 SC_XETABLE_HXX
25 #define SC_XETABLE_HXX
26 
27 #include "xltable.hxx"
28 
29 #include <deque>
30 #include <tools/mempool.hxx>
31 #include "xladdress.hxx"
32 #include "xerecord.hxx"
33 #include "xestring.hxx"
34 #include "xeformula.hxx"
35 #include "xestyle.hxx"
36 
37 /* ============================================================================
38 Export of cell tables including row and column description.
39 - Managing all used and formatted cells in a sheet.
40 - Row and column properties, i.e. width/height, visibility.
41 - Find default row formatting and default column formatting.
42 - Merged cell ranges.
43 ============================================================================ */
44 
45 // ============================================================================
46 // Helper records for cell records
47 // ============================================================================
48 
49 /** Represents a STRING record that contains the result of a string formula. */
50 class XclExpStringRec : public XclExpRecord
51 {
52 public:
53     explicit            XclExpStringRec( const XclExpRoot& rRoot, const String& rResult );
54 
55 private:
56     virtual void        WriteBody( XclExpStream& rStrm );
57 
58 private:
59     XclExpStringRef     mxResult;
60 };
61 
62 // Additional records for special formula ranges ==============================
63 
64 /** Base record for additional range formula records (i.e. ARRAY, SHRFMLA). */
65 class XclExpRangeFmlaBase : public XclExpRecord
66 {
67 public:
68     /** Returns true, if the passed cell position is equal to own base position. */
69     bool                IsBasePos( sal_uInt16 nXclCol, sal_uInt16 nXclRow ) const;
70 
71     /** Derived classes create the token array for a corresponding FORMULA cell record. */
72     virtual XclTokenArrayRef CreateCellTokenArray( const XclExpRoot& rRoot ) const = 0;
73     /** Derived classes return true, if the own formula contains volatile functions. */
74     virtual bool        IsVolatile() const = 0;
75 
76 protected:
77     /** Constructs the record with a single cell. */
78     explicit            XclExpRangeFmlaBase(
79                             sal_uInt16 nRecId, sal_uInt32 nRecSize, const ScAddress& rScPos );
80     /** Constructs the record with a cell range. */
81     explicit            XclExpRangeFmlaBase(
82                             sal_uInt16 nRecId, sal_uInt32 nRecSize, const ScRange& rScRange );
83 
84     /** Extends the cell range to include the passed cell address. */
85     void                Extend( const ScAddress& rScPos );
86 
87     /** Writes the range address covered by this record. */
88     void                WriteRangeAddress( XclExpStream& rStrm ) const;
89 
90 protected:
91     XclRange            maXclRange;     /// Range described by this record.
92     XclAddress          maBaseXclPos;   /// Address of base cell (first FORMULA record).
93 };
94 
95 typedef ScfRef< XclExpRangeFmlaBase > XclExpRangeFmlaRef;
96 
97 // Array formulas =============================================================
98 
99 class ScTokenArray;
100 
101 /** Represents an ARRAY record that contains the token array of a matrix formula.
102 
103     An ARRAY record is stored following the first FORMULA record that is part
104     of a matrix formula. All FORMULA records of a matrix formula contain a
105     reference to the ARRAY record, while the ARRAY record contains the formula
106     token array used by all formulas.
107  */
108 class XclExpArray : public XclExpRangeFmlaBase
109 {
110 public:
111     explicit            XclExpArray( XclTokenArrayRef xTokArr, const ScRange& rScRange );
112 
113     /** Creates and returns the token array for a corresponding FORMULA cell record. */
114     virtual XclTokenArrayRef CreateCellTokenArray( const XclExpRoot& rRoot ) const;
115     /** Returns true, if the array formula contains volatile functions. */
116     virtual bool        IsVolatile() const;
117 
118 private:
119     virtual void        WriteBody( XclExpStream& rStrm );
120 
121 private:
122     XclTokenArrayRef    mxTokArr;       /// The token array of a matrix formula.
123 };
124 
125 typedef ScfRef< XclExpArray > XclExpArrayRef;
126 
127 // ----------------------------------------------------------------------------
128 
129 /** Caches all ARRAY records. */
130 class XclExpArrayBuffer : protected XclExpRoot
131 {
132 public:
133     explicit            XclExpArrayBuffer( const XclExpRoot& rRoot );
134 
135     /** Inserts a new ARRAY record into the buffer and returns it. */
136     XclExpArrayRef      CreateArray( const ScTokenArray& rScTokArr, const ScRange& rScRange );
137     /** Tries to find an ARRAY record that corresponds to an ocMatRef token. */
138     XclExpArrayRef      FindArray( const ScTokenArray& rScTokArr ) const;
139 
140 private:
141     typedef ::std::map< ScAddress, XclExpArrayRef > XclExpArrayMap;
142     XclExpArrayMap      maRecMap;       /// Map containing the ARRAY records.
143 };
144 
145 // Shared formulas ============================================================
146 
147 /** Represents a SHRFMLA record that contains the token array of a shared formula.
148 
149     A SHRFMLA record is stored following the first FORMULA record that is part
150     of a shared formula. All FORMULA records of a shared formula contain a
151     reference to the SHRFMLA record, while the SHRFMLA record contains the
152     formula token array used by all formulas.
153  */
154 class XclExpShrfmla : public XclExpRangeFmlaBase
155 {
156 public:
157     /** Creates a SHRFMLA record that consists of the passed cell address only. */
158     explicit            XclExpShrfmla( XclTokenArrayRef xTokArr, const ScAddress& rScPos );
159 
160     /** Extends the cell range to include the passed cell address. */
161     void                ExtendRange( const ScAddress& rScPos );
162 
163     /** Creates and returns the token array for a corresponding FORMULA cell record. */
164     virtual XclTokenArrayRef CreateCellTokenArray( const XclExpRoot& rRoot ) const;
165     /** Returns true, if the shared formula contains volatile functions. */
166     virtual bool        IsVolatile() const;
167 
168 private:
169     virtual void        WriteBody( XclExpStream& rStrm );
170 
171 private:
172     XclTokenArrayRef    mxTokArr;       /// The token array of a shared formula.
173     sal_uInt8           mnUsedCount;    /// Number of FORMULA records referring to this record.
174 };
175 
176 typedef ScfRef< XclExpShrfmla > XclExpShrfmlaRef;
177 
178 // ----------------------------------------------------------------------------
179 
180 /** Caches all SHRFMLA records and provides functions to update their ranges. */
181 class XclExpShrfmlaBuffer : protected XclExpRoot
182 {
183 public:
184     explicit            XclExpShrfmlaBuffer( const XclExpRoot& rRoot );
185 
186     /** Tries to create a new or to update an existing SHRFMLA record.
187         @return  An empty reference, if the passed token array does not contain
188             a shared formula. If the token array is a shared formula, this
189             function updates its cell range to include the passed cell position,
190             if there is a SHRFMLA record for the passed token array; otherwise
191             this function creates and returns a new SHRFMLA record. */
192     XclExpShrfmlaRef    CreateOrExtendShrfmla(
193                             const ScTokenArray& rScTokArr, const ScAddress& rScPos );
194 
195 private:
196     typedef ::std::map< const ScTokenArray*, XclExpShrfmlaRef > XclExpShrfmlaMap;
197     XclExpShrfmlaMap    maRecMap;       /// Map containing the SHRFMLA records.
198 };
199 
200 // Multiple operations ========================================================
201 
202 struct XclMultipleOpRefs;
203 
204 /** Represents a TABLEOP record for a multiple operations range. */
205 class XclExpTableop : public XclExpRangeFmlaBase
206 {
207 public:
208     explicit            XclExpTableop( const ScAddress& rScPos,
209                             const XclMultipleOpRefs& rRefs, sal_uInt8 nScMode );
210 
211     /** Returns true, if the cell range has been extended to the passed position.
212         @descr  All references passed in rRefs must fit the ranges passed in the constructor. */
213     bool                TryExtend( const ScAddress& rScPos, const XclMultipleOpRefs& rRefs );
214 
215     /** Finalizes the record. Tests on valid cell range and reference addresses. */
216     void                Finalize();
217 
218     /** Creates and returns the token array for a corresponding FORMULA cell record. */
219     virtual XclTokenArrayRef CreateCellTokenArray( const XclExpRoot& rRoot ) const;
220     /** Returns true, if the multiple operations range is volatile. */
221     virtual bool        IsVolatile() const;
222     /** Writes the record if it is valid. */
223     virtual void        Save( XclExpStream& rStrm );
224 
225 private:
226     /** Returns true, if the passed cell position can be appended to this record. */
227     bool                IsAppendable( sal_uInt16 nXclCol, sal_uInt16 nXclRow ) const;
228 
229     /** Writes the contents of the TABLEOP record. */
230     virtual void        WriteBody( XclExpStream& rStrm );
231 
232 private:
233     SCTAB               mnScTab;        /// Sheet index of this record.
234     sal_uInt16          mnLastAppXclCol;/// Column index of last appended cell.
235     sal_uInt16          mnColInpXclCol; /// Column index of column input cell.
236     sal_uInt16          mnColInpXclRow; /// Row index of column input cell.
237     sal_uInt16          mnRowInpXclCol; /// Column index of row input cell.
238     sal_uInt16          mnRowInpXclRow; /// Row index of row input cell.
239     sal_uInt8           mnScMode;       /// Type of the multiple operation (Calc constant).
240     bool                mbValid;        /// true = Contains valid references.
241 };
242 
243 typedef ScfRef< XclExpTableop > XclExpTableopRef;
244 
245 // ----------------------------------------------------------------------------
246 
247 /** Contains all created TABLEOP records and supports creating or updating them. */
248 class XclExpTableopBuffer : protected XclExpRoot
249 {
250 public:
251     explicit            XclExpTableopBuffer( const XclExpRoot& rRoot );
252 
253     /** Tries to update an existing or to create a new TABLEOP record.
254         @return  Reference to the TABLEOP record for this cell (existing or new),
255             or an empty reference, if rScTokArr does not contain a multiple
256             operations formula. */
257     XclExpTableopRef    CreateOrExtendTableop(
258                             const ScTokenArray& rScTokArr, const ScAddress& rScPos );
259 
260     /** Finalizes all contained TABLEOP records. */
261     void                Finalize();
262 
263 private:
264     /** Tries to create a new TABLEOP record, if rRefs contains valid references. */
265     XclExpTableopRef    TryCreate( const ScAddress& rScPos, const XclMultipleOpRefs& rRefs );
266 
267 private:
268     typedef XclExpRecordList< XclExpTableop > XclExpTableopList;
269     XclExpTableopList   maTableopList;  /// List of all TABLEOP records.
270 };
271 
272 // ============================================================================
273 // Cell records
274 // ============================================================================
275 
276 /** The base class of all cell records. */
277 class XclExpCellBase : public XclExpRecord
278 {
279 public:
280     /** Returns the (first) address of the cell(s). */
GetXclPos() const281     inline const XclAddress& GetXclPos() const { return maXclPos; }
282     /** Returns the (first) Excel column index of the cell(s). */
GetXclCol() const283     inline sal_uInt16   GetXclCol() const { return maXclPos.mnCol; }
284     /** Returns the Excel row index of the cell. */
GetXclRow() const285     inline sal_uInt16   GetXclRow() const { return maXclPos.mnRow; }
286 
287     /** Derived classes return the column index of the last contained cell. */
288     virtual sal_uInt16  GetLastXclCol() const = 0;
289     /** Derived classes return the XF identifier of the first contained cell. */
290     virtual sal_uInt32  GetFirstXFId() const = 0;
291     /** Derived classes return true, if this record does not contain at least one valid cell. */
292     virtual bool        IsEmpty() const = 0;
293     /** Derived classes return whether the cell contains multi-line text. */
294     virtual bool        IsMultiLineText() const;
295 
296     /** Derived classes try to merge the contents of the passed cell to own data. */
297     virtual bool        TryMerge( const XclExpCellBase& rCell );
298     /** Derived classes convert the XF identifier(s) into the Excel XF index(es).
299         @param rXFIndexes  The converted XF index(es) are inserted here. */
300     virtual void        ConvertXFIndexes( const XclExpRoot& rRoot ) = 0;
301     /** Derived classes for blank cells insert the Excel XF index(es) into the passed vector. */
302     virtual void        GetBlankXFIndexes( ScfUInt16Vec& rXFIndexes ) const;
303     /** Derived classes for blank cells remove unused Excel XF index(es). */
304     virtual void        RemoveUnusedBlankCells( const ScfUInt16Vec& rXFIndexes );
305 
306 protected:
307     explicit            XclExpCellBase(
308                             sal_uInt16 nRecId, sal_Size nContSize, const XclAddress& rXclPos );
309 
310     /** Sets this record to a new column position. */
SetXclCol(sal_uInt16 nXclCol)311     inline void         SetXclCol( sal_uInt16 nXclCol ) { maXclPos.mnCol = nXclCol; }
312     /** Sets this record to a new row position. */
SetXclRow(sal_uInt16 nXclRow)313     inline void         SetXclRow( sal_uInt16 nXclRow ) { maXclPos.mnRow = nXclRow; }
314 
315 private:
316     XclAddress          maXclPos;       /// Address of the cell.
317 };
318 
319 typedef ScfRef< XclExpCellBase > XclExpCellRef;
320 
321 // Single cell records ========================================================
322 
323 /** Base class for all cell records not supporting multiple contents. */
324 class XclExpSingleCellBase : public XclExpCellBase
325 {
326 public:
327     /** Returns the last column, which is equal to the first column for single cells. */
328     virtual sal_uInt16  GetLastXclCol() const;
329     /** Return the XF identifier of the cell. */
330     virtual sal_uInt32  GetFirstXFId() const;
331     /** Returns true, if this record does not contain at least one valid cell. */
332     virtual bool        IsEmpty() const;
333     /** Converts the XF identifier into the Excel XF index. */
334     virtual void        ConvertXFIndexes( const XclExpRoot& rRoot );
335     /** Writes cell address, XF index, and calls WriteContents() for each cell. */
336     virtual void        Save( XclExpStream& rStrm );
337 
338 protected:
339     explicit            XclExpSingleCellBase( sal_uInt16 nRecId, sal_Size nContSize,
340                             const XclAddress& rXclPos, sal_uInt32 nXFId );
341 
342     explicit            XclExpSingleCellBase( const XclExpRoot& rRoot,
343                             sal_uInt16 nRecId, sal_Size nContSize, const XclAddress& rXclPos,
344                             const ScPatternAttr* pPattern, sal_Int16 nScript, sal_uInt32 nForcedXFId );
345 
SetContSize(sal_Size nContSize)346     inline void         SetContSize( sal_Size nContSize ) { mnContSize = nContSize; }
GetContSize() const347     inline sal_Size     GetContSize() const { return mnContSize; }
348 
SetXFId(sal_uInt32 nXFId)349     inline void         SetXFId( sal_uInt32 nXFId ) { maXFId.mnXFId = nXFId; }
GetXFId() const350     inline sal_uInt32   GetXFId() const { return maXFId.mnXFId; }
351 
352 private:
353     /** Writes cell address, XF index, and calls WriteContents() for each cell. */
354     virtual void        WriteBody( XclExpStream& rStrm );
355     /** Derived classes write the contents of the specified cell (without XF index). */
356     virtual void        WriteContents( XclExpStream& rStrm ) = 0;
357 
358 private:
359     XclExpXFId          maXFId;         /// The XF identifier of the cell formatting.
360     sal_Size            mnContSize;     /// The size of the cell contents.
361 };
362 
363 // ----------------------------------------------------------------------------
364 
365 /** Represents a NUMBER record that describes a cell with a double value. */
366 class XclExpNumberCell : public XclExpSingleCellBase
367 {
368     DECL_FIXEDMEMPOOL_NEWDEL( XclExpNumberCell )
369 
370 public:
371     explicit            XclExpNumberCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
372                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
373                             double fValue );
374 
375     virtual void        SaveXml( XclExpXmlStream& rStrm );
376 private:
377     virtual void        WriteContents( XclExpStream& rStrm );
378 
379 private:
380     double              mfValue;        /// The cell value.
381 };
382 
383 // ----------------------------------------------------------------------------
384 
385 /** Represents a BOOLERR record that describes a cell with a Boolean value. */
386 class XclExpBooleanCell : public XclExpSingleCellBase
387 {
388     DECL_FIXEDMEMPOOL_NEWDEL( XclExpBooleanCell )
389 
390 public:
391     explicit            XclExpBooleanCell( const XclExpRoot rRoot, const XclAddress& rXclPos,
392                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
393                             bool bValue );
394 
395     virtual void        SaveXml( XclExpXmlStream& rStrm );
396 private:
397     virtual void        WriteContents( XclExpStream& rStrm );
398 
399 private:
400     bool                mbValue;        /// The cell value.
401 };
402 
403 // ----------------------------------------------------------------------------
404 
405 //UNUSED2009-05 /** Represents a BOOLERR record that describes a cell with an error code. */
406 //UNUSED2009-05 class XclExpErrorCell : public XclExpSingleCellBase
407 //UNUSED2009-05 {
408 //UNUSED2009-05     DECL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell )
409 //UNUSED2009-05
410 //UNUSED2009-05 public:
411 //UNUSED2009-05     explicit            XclExpErrorCell( const XclExpRoot rRoot, const XclAddress& rXclPos,
412 //UNUSED2009-05                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
413 //UNUSED2009-05                             sal_uInt8 nErrCode );
414 //UNUSED2009-05
415 //UNUSED2009-05     virtual void        SaveXml( XclExpXmlStream& rStrm );
416 //UNUSED2009-05 private:
417 //UNUSED2009-05     virtual void        WriteContents( XclExpStream& rStrm );
418 //UNUSED2009-05
419 //UNUSED2009-05 private:
420 //UNUSED2009-05     sal_uInt8           mnErrCode;      /// The error code.
421 //UNUSED2009-05 };
422 
423 // ----------------------------------------------------------------------------
424 
425 class ScStringCell;
426 class ScEditCell;
427 class XclExpHyperlinkHelper;
428 
429 /** Represents a text cell record.
430 
431     May contain a BIFF2-BIFF7 LABEL record for a simple string, or a BIFF2-BIFF7
432     RSTRING record for a formatted string, or a BIFF8 LABELSST string for any
433     string (simply stores a reference to the Shared String Table).
434  */
435 class XclExpLabelCell : public XclExpSingleCellBase
436 {
437     DECL_FIXEDMEMPOOL_NEWDEL( XclExpLabelCell )
438 
439 public:
440     /** Constructs the record from an unformatted Calc string cell. */
441     explicit            XclExpLabelCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
442                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
443                             const ScStringCell& rCell );
444 
445     /** Constructs the record from a formatted Calc edit cell. */
446     explicit            XclExpLabelCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
447                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
448                             const ScEditCell& rCell, XclExpHyperlinkHelper& rHlinkHelper );
449 
450     /** Returns true if the cell contains multi-line text. */
451     virtual bool        IsMultiLineText() const;
452 
453     virtual void        SaveXml( XclExpXmlStream& rStrm );
454 private:
455     /** Initializes the record contents. Called from constructors. */
456     void                Init( const XclExpRoot& rRoot,
457                             const ScPatternAttr* pPattern, XclExpStringRef xText );
458 
459     virtual void        WriteContents( XclExpStream& rStrm );
460 
461 private:
462     XclExpStringRef     mxText;         /// The cell text.
463     sal_uInt32          mnSstIndex;     /// Index into Shared String Table (only used for BIFF8).
464     bool                mbLineBreak;    /// True = cell has automatic linebreaks enabled.
465 };
466 
467 // ----------------------------------------------------------------------------
468 
469 class ScFormulaCell;
470 
471 /** Represents a FORMULA record that describes a cell with a formula. */
472 class XclExpFormulaCell : public XclExpSingleCellBase
473 {
474     DECL_FIXEDMEMPOOL_NEWDEL( XclExpFormulaCell )
475 
476 public:
477     explicit            XclExpFormulaCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
478                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
479                             const ScFormulaCell& rScFmlaCell,
480                             XclExpArrayBuffer& rArrayBfr,
481                             XclExpShrfmlaBuffer& rShrfmlaBfr,
482                             XclExpTableopBuffer& rTableopBfr );
483 
484     /** Writes the FORMULA record and additional records related to the formula. */
485     virtual void        Save( XclExpStream& rStrm );
486     virtual void        SaveXml( XclExpXmlStream& rStrm );
487 
488 private:
489     virtual void        WriteContents( XclExpStream& rStrm );
490 
491 private:
492     ScFormulaCell&      mrScFmlaCell;   /// The Calc formula cell.
493     XclTokenArrayRef    mxTokArr;       /// The token array of the formula.
494     XclExpRangeFmlaRef  mxAddRec;       /// Additional record for matrix/shared formulas.
495     XclExpRecordRef     mxStringRec;    /// STRING record for string result.
496 };
497 
498 // Multiple cell records ======================================================
499 
500 struct XclExpMultiXFId : public XclExpXFId
501 {
502     sal_uInt16          mnCount;        /// Number of XF identifiers.
503 
XclExpMultiXFIdXclExpMultiXFId504     inline explicit     XclExpMultiXFId( sal_uInt32 nXFId, sal_uInt16 nCount = 1 ) :
505                             XclExpXFId( nXFId ), mnCount( nCount ) {}
506 };
507 
508 // ----------------------------------------------------------------------------
509 
510 /** Base class for all cell records supporting multiple contents. */
511 class XclExpMultiCellBase : public XclExpCellBase
512 {
513 public:
514     /** Returns the column index of the last cell this record describes. */
515     virtual sal_uInt16  GetLastXclCol() const;
516     /** Return the XF identifier of the first contained cell. */
517     virtual sal_uInt32  GetFirstXFId() const;
518     /** Returns true, if this record does not contain at least one valid cell. */
519     virtual bool        IsEmpty() const;
520 
521     /** Convert all XF identifiers into the Excel XF indexes. */
522     virtual void        ConvertXFIndexes( const XclExpRoot& rRoot );
523     /** Writes the record, calls WriteContents() for each contained cell.
524         @descr  May write several records, if unused XF indexes are contained. */
525     virtual void        Save( XclExpStream& rStrm );
526     virtual void        SaveXml( XclExpXmlStream& rStrm );
527 
528 protected:
529     explicit            XclExpMultiCellBase( sal_uInt16 nRecId, sal_uInt16 nMulRecId,
530                             sal_Size nContSize, const XclAddress& rXclPos );
531 
532     /** Sets the size of the remaining contents of one cell (without the XF index). */
SetContSize(sal_Size nContSize)533     inline void         SetContSize( sal_Size nContSize ) { mnContSize = nContSize; }
534     /** Returns the size of the remaining contents of one cell (without the XF index). */
GetContSize() const535     inline sal_Size     GetContSize() const { return mnContSize; }
536 
537     /** Returns the number of cells this record represents. */
538     sal_uInt16          GetCellCount() const;
539 
540     /** Appends the passed XF identifier nCount times to the list of XF identifiers. */
541     void                AppendXFId( const XclExpMultiXFId& rXFId );
542     /** Appends the passed cell format nCount times to the list of XF identifiers. */
543     void                AppendXFId( const XclExpRoot& rRoot,
544                             const ScPatternAttr* pPattern, sal_uInt16 nScript,
545                             sal_uInt32 nForcedXFId, sal_uInt16 nCount = 1 );
546 
547     /** Tries to merge the XF ID list of the passed cell with the own list. */
548     bool                TryMergeXFIds( const XclExpMultiCellBase& rCell );
549     /** Inserts the Excel XF index(es) into the passed vector. */
550     void                GetXFIndexes( ScfUInt16Vec& rXFIndexes ) const;
551 
552     /** Removes unused Excel XF index(es).
553         @param rXFIndexes  Specifies which XF indexes are used. */
554     void                RemoveUnusedXFIndexes( const ScfUInt16Vec& rXFIndexes );
555 
556 private:
557     /** Derived classes write the remaining contents of the specified cell (without XF index).
558         @param nRelCol  Relative column index (starts with 0 for first cell of this record). */
559     virtual void        WriteContents( XclExpStream& rStrm, sal_uInt16 nRelCol ) = 0;
560     virtual void        WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& rAddress, sal_uInt32 nXFId, sal_uInt16 nRelCol ) = 0;
561 
562 private:
563     typedef ::std::deque< XclExpMultiXFId > XclExpMultiXFIdDeq;
564 
565     sal_uInt16          mnMulRecId;     /// Record ID for multiple record variant.
566     sal_Size            mnContSize;     /// Data size of contents for one cell
567     XclExpMultiXFIdDeq  maXFIds;        /// The XF identifiers of the cell formatting.
568 };
569 
570 // ----------------------------------------------------------------------------
571 
572 /** Represents a BLANK or MULBLANK record that describes empty but formatted cells. */
573 class XclExpBlankCell : public XclExpMultiCellBase
574 {
575     DECL_FIXEDMEMPOOL_NEWDEL( XclExpBlankCell )
576 
577 public:
578     explicit            XclExpBlankCell( const XclAddress& rXclPos, const XclExpMultiXFId& rXFId );
579 
580     explicit            XclExpBlankCell( const XclExpRoot& rRoot,
581                             const XclAddress& rXclPos, sal_uInt16 nLastXclCol,
582                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId );
583 
584     /** Tries to merge the contents of the passed cell to own data. */
585     virtual bool        TryMerge( const XclExpCellBase& rCell );
586     /** Inserts the Excel XF index(es) into the passed vector. */
587     virtual void        GetBlankXFIndexes( ScfUInt16Vec& rXFIndexes ) const;
588     /** Tries to remove unused Excel XF index(es). */
589     virtual void        RemoveUnusedBlankCells( const ScfUInt16Vec& rXFIndexes );
590 
591 private:
592     /** Writes the remaining contents of the specified cell (without XF index). */
593     virtual void        WriteContents( XclExpStream& rStrm, sal_uInt16 nRelCol );
594     virtual void        WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& rAddress, sal_uInt32 nXFId, sal_uInt16 nRelCol );
595 };
596 
597 // ----------------------------------------------------------------------------
598 
599 /** Represents an RK or MULRK record that describes cells with a compressed double values. */
600 class XclExpRkCell : public XclExpMultiCellBase
601 {
602     DECL_FIXEDMEMPOOL_NEWDEL( XclExpRkCell )
603 
604 public:
605     explicit            XclExpRkCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
606                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
607                             sal_Int32 nRkValue );
608 
609     /** Tries to merge the contents of the passed cell to own data. */
610     virtual bool        TryMerge( const XclExpCellBase& rCell );
611 
612 private:
613     /** Writes the remaining contents of the specified cell (without XF index). */
614     virtual void        WriteContents( XclExpStream& rStrm, sal_uInt16 nRelCol );
615     virtual void        WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& rAddress, sal_uInt32 nXFId, sal_uInt16 nRelCol );
616 
617 private:
618     ScfInt32Vec         maRkValues;     /// The cell values.
619 };
620 
621 // ============================================================================
622 // Rows and Columns
623 // ============================================================================
624 
625 class ScOutlineArray;
626 
627 /** Base class for buffers containing row or column outline data. */
628 class XclExpOutlineBuffer
629 {
630 public:
631     /** Returns true, if a collapsed group ends at the last processed position. */
IsCollapsed() const632     inline bool         IsCollapsed() const { return mbCurrCollapse; }
633     /** Returns the highest level of an open group at the last processed position. */
GetLevel() const634     inline sal_uInt8    GetLevel() const { return ::std::min( mnCurrLevel, EXC_OUTLINE_MAX ); }
635 
636 protected:
637     /** Constructs the outline buffer.
638         @param bRows  true = Process row ouline array; false = Process column outline array. */
639     explicit            XclExpOutlineBuffer( const XclExpRoot& rRoot, bool bRows );
640 
641     /** Updates the current state by processing the settings at the passed Calc position. */
642     void                UpdateColRow( SCCOLROW nScPos );
643 
644 private:
645     /** Data about an outline level. */
646     struct XclExpLevelInfo
647     {
648         SCCOLROW            mnScEndPos;         /// The end position of a group in a level.
649         bool                mbHidden;           /// true = Group in this level is hidden.
XclExpLevelInfoXclExpOutlineBuffer::XclExpLevelInfo650         inline explicit     XclExpLevelInfo() : mnScEndPos( 0 ), mbHidden( false ) {}
651     };
652     typedef ::std::vector< XclExpLevelInfo > XclExpLevelInfoVec;
653 
654     const ScOutlineArray* mpScOLArray;      /// Pointer to Calc outline array.
655     XclExpLevelInfoVec  maLevelInfos;       /// Info for current row and all levels.
656     sal_uInt8           mnCurrLevel;        /// Highest level of an open group for current position.
657     bool                mbCurrCollapse;     /// true = Collapsed group ends at current position.
658 };
659 
660 // ----------------------------------------------------------------------------
661 
662 /** The outline buffer for column outlines. */
663 class XclExpColOutlineBuffer : public XclExpOutlineBuffer
664 {
665 public:
XclExpColOutlineBuffer(const XclExpRoot & rRoot)666     inline explicit     XclExpColOutlineBuffer( const XclExpRoot& rRoot ) :
667                             XclExpOutlineBuffer( rRoot, false ) {}
668 
669     /** Updates the current state by processing the settings of the passed Calc column. */
Update(SCCOL nScCol)670     inline void         Update( SCCOL nScCol )
671                             { UpdateColRow( static_cast< SCCOLROW >( nScCol ) ); }
672 };
673 
674 // ----------------------------------------------------------------------------
675 
676 /** The outline buffer for row outlines. */
677 class XclExpRowOutlineBuffer : public XclExpOutlineBuffer
678 {
679 public:
XclExpRowOutlineBuffer(const XclExpRoot & rRoot)680     inline explicit     XclExpRowOutlineBuffer( const XclExpRoot& rRoot ) :
681                             XclExpOutlineBuffer( rRoot, true ) {}
682 
683     /** Updates the current state by processing the settings of the passed Calc row. */
Update(SCROW nScRow)684     inline void         Update( SCROW nScRow )
685                             { UpdateColRow( static_cast< SCCOLROW >( nScRow ) ); }
686 };
687 
688 // ----------------------------------------------------------------------------
689 
690 /** Represents a GUTS record containing the level count of row and column outlines. */
691 class XclExpGuts : public XclExpRecord
692 {
693 public:
694     explicit            XclExpGuts( const XclExpRoot& rRoot );
695 
696 private:
697     virtual void        WriteBody( XclExpStream& rStrm );
698 
699 private:
700     sal_uInt16          mnColLevels;    /// Number of visible column outline levels.
701     sal_uInt16          mnColWidth;     /// Width of column outline area (pixels).
702     sal_uInt16          mnRowLevels;    /// Number of visible row outline levels.
703     sal_uInt16          mnRowWidth;     /// Width of row outline area (pixels).
704 };
705 
706 // ----------------------------------------------------------------------------
707 
708 /** Represents a DIMENSIONS record containing the used area of a sheet. */
709 class XclExpDimensions : public XclExpRecord
710 {
711 public:
712     explicit            XclExpDimensions( const XclExpRoot& rRoot );
713 
714     /** Sets the used area to the record. */
715     void                SetDimensions(
716                             sal_uInt16 nFirstUsedXclCol, sal_uInt32 nFirstUsedXclRow,
717                             sal_uInt16 nFirstFreeXclCol, sal_uInt32 nFirstFreeXclRow );
718 
719     virtual void        SaveXml( XclExpXmlStream& rStrm );
720 private:
721     /** Writes the contents of the DIMENSIONS record. */
722     virtual void        WriteBody( XclExpStream& rStrm );
723 
724 private:
725     sal_uInt32          mnFirstUsedXclRow;  /// First used row.
726     sal_uInt32          mnFirstFreeXclRow;  /// First unused row after used area.
727     sal_uInt16          mnFirstUsedXclCol;  /// First used column.
728     sal_uInt16          mnFirstFreeXclCol;  /// First free column after used area.
729 };
730 
731 // ============================================================================
732 
733 /** Represents the DEFCOLWIDTH record containing the default column width of a sheet.
734 
735     Excel stores the default column width in entire character widths of the '0'
736     character using the application default font (i.e. the default width is 10,
737     if the '0' character fits 10 times into a cell in a column with default
738     width.
739 
740     The IsDefWidth() function returns true, if the passed width (measured in
741     1/256 of the width of the '0' character) could be converted exactly to the
742     default width. If the passed width is rounded up or down to get the default
743     width, the function returns false.
744  */
745 class XclExpDefcolwidth : public XclExpUInt16Record, protected XclExpRoot
746 {
747 public:
748     explicit            XclExpDefcolwidth( const XclExpRoot& rRoot );
749 
750     /** Returns true, if the own default width exactly matches the passed width. */
751     bool                IsDefWidth( sal_uInt16 nXclColWidth ) const;
752 
753     /** Sets the passed column width (in 1/256 character width) as default width. */
754     void                SetDefWidth( sal_uInt16 nXclColWidth );
755 };
756 
757 // ----------------------------------------------------------------------------
758 
759 /** Contains the column settings for a range of columns.
760 
761     After construction the record contains a temporary XF identifier returned
762     from the XF buffer. After creating the entire Excel document in memory, the
763     ConvertXFIndexes() function converts it into the real Excel XF index.
764  */
765 class XclExpColinfo : public XclExpRecord, protected XclExpRoot
766 {
767 public:
768     /** Constructs the record with the settings in the Calc document. */
769     explicit            XclExpColinfo( const XclExpRoot& rRoot,
770                             SCCOL nScCol, SCROW nLastScRow,
771                             XclExpColOutlineBuffer& rOutlineBfr );
772 
773     /** Converts the XF identifier into the Excel XF index, returns the latter. */
774     sal_uInt16          ConvertXFIndexes();
775 
776     /** Tries to merge this record with the passed record.
777         @descr  Possible, if passed record directly follows this record and has equal contents.
778         @return  true = This record is equal to passed record and has been updated. */
779     bool                TryMerge( const XclExpColinfo& rColInfo );
780 
781     /** Returns the Excel width of the column(s). */
GetColWidth() const782     inline sal_uInt16   GetColWidth() const { return mnWidth; }
783     /** Returns the final Excel XF index of the column(s). */
GetXFIndex() const784     inline sal_uInt16   GetXFIndex() const { return maXFId.mnXFIndex; }
785     /** Returns the number of columns represented by this record. */
GetColCount() const786     inline sal_uInt16   GetColCount() const { return mnLastXclCol - mnFirstXclCol + 1; }
787 
788     /** Returns true, if the column has default format and width. */
789     bool                IsDefault( const XclExpDefcolwidth& rDefColWidth ) const;
790 
791     virtual void        SaveXml( XclExpXmlStream& rStrm );
792 
793 private:
794     /** Writes the contents of this COLINFO record. */
795     virtual void        WriteBody( XclExpStream& rStrm );
796 
797 private:
798     XclExpXFId          maXFId;             /// The XF identifier for column default format.
799     sal_uInt16          mnWidth;            /// Excel width of the column.
800     sal_uInt16          mnFlags;            /// Additional column flags.
801     sal_uInt16          mnFirstXclCol;      /// Index to first column.
802     sal_uInt16          mnLastXclCol;       /// Index to last column.
803 };
804 
805 // ----------------------------------------------------------------------------
806 
807 /** Contains COLINFO records for all columns of a Calc sheet.
808 
809     On construction one COLINFO record per column is created. After creating
810     the entire Excel document in memory, the ConvertXFIndexes() function converts
811     all temporary XF identifiers into real Excel XF indexes and merges all equal
812     COLINFO records together.
813  */
814 class XclExpColinfoBuffer : public XclExpRecordBase, protected XclExpRoot
815 {
816 public:
817     explicit            XclExpColinfoBuffer( const XclExpRoot& rRoot );
818 
819     /** Initializes the buffer: finds settings and formatting of all columns.
820         @param nLastScRow  Last row used to find default formatting. */
821     void                Initialize( SCROW nLastScRow );
822     /** Converts the XF identifiers into the Excel XF indexes and merges equal columns.
823         @param rXFIndexes  Returns the final XF indexes of all columns. */
824     void                Finalize( ScfUInt16Vec& rXFIndexes );
825 
826     /** Writes all COLINFO records of this buffer. */
827     virtual void        Save( XclExpStream& rStrm );
828     virtual void        SaveXml( XclExpXmlStream& rStrm );
829 
830 private:
831     typedef XclExpRecordList< XclExpColinfo >   XclExpColinfoList;
832     typedef XclExpColinfoList::RecordRefType    XclExpColinfoRef;
833 
834     XclExpColinfoList   maColInfos;         /// List of COLINFO records.
835     XclExpDefcolwidth   maDefcolwidth;      /// The DEFCOLWIDTH record.
836     XclExpColOutlineBuffer maOutlineBfr;    /// Buffer for column outline groups.
837 };
838 
839 // ============================================================================
840 
841 class XclExpRow;
842 
843 /** Contains all possible default row settings. */
844 struct XclExpDefaultRowData
845 {
846     sal_uInt16          mnFlags;            /// Default flags for unspecified rows.
847     sal_uInt16          mnHeight;           /// Default height for unspecified rows.
848 
849     explicit            XclExpDefaultRowData();
850     explicit            XclExpDefaultRowData( const XclExpRow& rRow );
851 
852     /** Returns true, if rows are hidden by default. */
IsHiddenXclExpDefaultRowData853     inline bool         IsHidden() const { return ::get_flag( mnFlags, EXC_DEFROW_HIDDEN ); }
854     /** Returns true, if the rows have a manually set height by default. */
IsUnsyncedXclExpDefaultRowData855     inline bool         IsUnsynced() const { return ::get_flag( mnFlags, EXC_DEFROW_UNSYNCED ); }
856 };
857 
858 // ----------------------------------------------------------------------------
859 
860 /** Represents a DEFROWHEIGHT record containing default format for unused rows. */
861 class XclExpDefrowheight : public XclExpRecord
862 {
863 public:
864     explicit            XclExpDefrowheight();
865 
866     /** Sets the passed default data as current record contents. */
867     void                SetDefaultData( const XclExpDefaultRowData& rDefData );
868 
869 private:
870     /** Writes the contents of the record. */
871     virtual void        WriteBody( XclExpStream& rStrm );
872 
873 private:
874     XclExpDefaultRowData maDefData;         /// Record data.
875 };
876 
877 // ----------------------------------------------------------------------------
878 
879 /** Represents a ROW record and additionally contains all cells records of a row.
880 
881     This class contains all cell records of a row in a spreadsheet. There are 2
882     cell records in Excel that support storing a range of cells in one record
883     (MULBLANK for multiple blank cells, and MULRK for multiple RK values). The
884     insertion functions try to merge a new inserted cell with existing
885     neighbors, if this is supported by the current type of cell record.
886 
887     The Finalize() function converts the XF identifiers of all cell records to
888     the final Excel XF indexes. Then a default
889  */
890 class XclExpRow : public XclExpRecord, protected XclExpRoot
891 {
892 public:
893     /** Constructs the ROW record and converts the Calc row settings.
894         @param bAlwaysEmpty  true = This row will not be filled with blank cells
895             in the Finalize() function. */
896     explicit            XclExpRow( const XclExpRoot& rRoot, sal_uInt16 nXclRow,
897                             XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty );
898 
899     /** Returns the excel row index of this ROW record. */
GetXclRow() const900     inline sal_uInt16   GetXclRow() const { return mnXclRow; }
901     /** Returns the height of the row in twips. */
GetHeight() const902     inline sal_uInt16   GetHeight() const { return mnHeight; }
903     /** Returns true, if this row does not contain at least one valid cell. */
IsEmpty() const904     inline bool         IsEmpty() const { return maCellList.IsEmpty(); }
905     /** Returns true, if this row is hidden. */
IsHidden() const906     inline bool         IsHidden() const { return ::get_flag( mnFlags, EXC_ROW_HIDDEN ); }
907     /** Returns true, if this row contains a manually set height. */
IsUnsynced() const908     inline bool         IsUnsynced() const { return ::get_flag( mnFlags, EXC_ROW_UNSYNCED ); }
909     /** Returns true, if this row is enabled (will be exported). */
IsEnabled() const910     inline bool         IsEnabled() const { return mbEnabled; }
911 
912     /** Appends the passed cell object to this row. */
913     void                AppendCell( XclExpCellRef xCell, bool bIsMergedBase );
914 
915     /** Converts all XF identifiers into the Excel XF indexes. */
916     void                Finalize( const ScfUInt16Vec& rColXFIndexes );
917 
918     /** Returns the column index of the first used cell in this row.
919         @descr  This function can only be called after Finalize(). */
920     sal_uInt16          GetFirstUsedXclCol() const;
921     /** Returns the column index of the first unused cell following all used cells in this row.
922         @descr  This function can only be called after Finalize(). */
923     sal_uInt16          GetFirstFreeXclCol() const;
924 
925     /** Returns true, if this row may be omitted by using the DEFROWHEIGHT record.
926         @descr  A row may be omitted, if it does not contain any cell or
927         explicit default cell formatting, and is not part of an outline.
928         This function can only be called after Finalize(). */
929     bool                IsDefaultable() const;
930     /** Disables this row, if it is defaultable and has the passed default format.
931         @descr  Disabled rows will not be saved.
932             This function can only be called after Finalize(). */
933     void                DisableIfDefault( const XclExpDefaultRowData& rDefRowData );
934 
935     /** Writes all cell records of this row. */
936     void                WriteCellList( XclExpStream& rStrm );
937 
938     /** Writes the ROW record if the row is not disabled (see DisableIfDefault() function). */
939     virtual void        Save( XclExpStream& rStrm );
940     virtual void        SaveXml( XclExpXmlStream& rStrm );
941 
942 private:
943     /** Initializes the record data. Called from constructors. */
944     void                Init( sal_uInt16 nXclRow, XclExpRowOutlineBuffer* pOutlineBfr );
945     /** Inserts a cell at the specified list position, tries to merge with neighbors. */
946     void                InsertCell( XclExpCellRef xCell, size_t nPos, bool bIsMergedBase );
947 
948     /** Writes the contents of the ROW record. */
949     virtual void        WriteBody( XclExpStream& rStrm );
950 
951 private:
952     typedef XclExpRecordList< XclExpCellBase > XclExpCellList;
953 
954     XclExpCellList      maCellList;         /// List of cell records for this row.
955     sal_uInt16          mnXclRow;           /// Excel row index of this row.
956     sal_uInt16          mnHeight;           /// Row height in twips.
957     sal_uInt16          mnFlags;            /// Flags for the ROW record.
958     sal_uInt16          mnXFIndex;          /// Default row formatting.
959     sal_uInt16          mnOutlineLevel;     /// Outline Level (for OOXML)
960     bool                mbAlwaysEmpty;      /// true = Do not add blank cells in Finalize().
961     bool                mbEnabled;          /// true = Write this ROW record.
962 };
963 
964 // ----------------------------------------------------------------------------
965 
966 /** Collects all rows which contain all cells of a sheet.
967 
968     This row buffer automatically creates ROW records when cells are inserted
969     with the AppendCell() function. It is possible to force creation of more
970     ROW records with the CreateRows() function. In both cases, all preceding
971     missing ROW records are inserted too.
972  */
973 class XclExpRowBuffer : public XclExpRecordBase, protected XclExpRoot
974 {
975 public:
976     explicit            XclExpRowBuffer( const XclExpRoot& rRoot );
977 
978     /** Appends the passed cell object to the row that the cell specifies. */
979     void                AppendCell( XclExpCellRef xCell, bool bIsMergedBase );
980     /** Forces insertion of all ROW records before the passed row. */
981     void                CreateRows( SCROW nFirstFreeScRow );
982 
983     /** Converts all XF identifiers into the Excel XF indexes and calculates default formats.
984         @param rDefRowData  (out-param) The default row format is returned here.
985         @param rColXFIndexes  The column default XF indexes. */
986     void                Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt16Vec& rColXFIndexes );
987 
988     /** Writes the DIMENSIONS record, all ROW records and all cell records. */
989     virtual void        Save( XclExpStream& rStrm );
990     virtual void        SaveXml( XclExpXmlStream& rStrm );
991 
992     XclExpDimensions*   GetDimensions();
993 
994 private:
995     /** Returns access to the specified ROW record. Inserts preceding missing ROW records.
996         @param bRowAlwaysEmpty  true = Created rows will not be filled with blank cells
997             in the XclExpRow::Finalize() function. */
998     XclExpRow&          GetOrCreateRow( sal_uInt16 nXclRow, bool bRowAlwaysEmpty );
999 
1000 private:
1001     typedef XclExpRecordList< XclExpRow >   XclExpRowList;
1002     typedef XclExpRowList::RecordRefType    XclExpRowRef;
1003 
1004     XclExpRowList       maRowList;          /// List of all ROW records.
1005     XclExpRowOutlineBuffer maOutlineBfr;    /// Buffer for row outline groups.
1006     XclExpDimensions    maDimensions;       /// DIMENSIONS record for used area.
1007     XclExpRow*          mpLastUsedRow;      /// Last used row for faster access.
1008     sal_uInt16          mnLastUsedXclRow;   /// Last used row for faster access.
1009 };
1010 
1011 // ============================================================================
1012 // Cell Table
1013 // ============================================================================
1014 
1015 class XclExpNote;
1016 class XclExpMergedcells;
1017 class XclExpHyperlink;
1018 class XclExpDval;
1019 
1020 /** This class contains the cell contents and more of an entire sheet.
1021 
1022     The cell table includes the settings and default formatting of all columns,
1023     the settings and default formatting of all used rows, and the contents of
1024     all cells of one sheet in a spreadsheet document.
1025 
1026     The constructor does all the work creating the cell table. It reads the
1027     Calc sheet and converts all columns, rows, and cells to Excel record data.
1028     Additioanlly, hyperlink records, note records, additional records for
1029     formula cells, data validation records, and outline records are created.
1030 
1031     The Finalize() function does even more work. It calculates default column
1032     settings and removes column records that are equal to this default. The
1033     same happens with rows: A default format is calculated for each row, and
1034     all blank cells in this row that have the same format are removed. Then,
1035     the most used row settings are calculated, and all empty rows that have the
1036     same settings are removed too.
1037 
1038     Records that are not stored inside the cell table area in an Excel file
1039     (i.e. DEFROWHEIGHT record, NOTE records, MERGEDCELLS record, HLINK records,
1040     DVAL and DV records for data validation) can be accessed with the function
1041     CreateRecord(). It returns the reference to the respective record (or
1042     record list) which can be inserted into a record list.
1043  */
1044 class XclExpCellTable : public XclExpRecordBase, protected XclExpRoot
1045 {
1046 public:
1047     explicit            XclExpCellTable( const XclExpRoot& rRoot );
1048 
1049     /** Converts all XF identifiers into the Excel XF indexes and calculates default formats. */
1050     void                Finalize();
1051 
1052     /** Returns the reference to an internal record specified by the passed record id.
1053         @param nRecId  The record identifier that specifies which record is
1054             returned. Possible values are: EXC_ID_DEFROWHEIGHT, EXC_ID_NOTE,
1055             EXC_ID_MERGEDCELLS, EXC_ID_HLINK, EXC_ID_DVAL. */
1056     XclExpRecordRef     CreateRecord( sal_uInt16 nRecId ) const;
1057     /** Saves the entire cell table. */
1058     virtual void        Save( XclExpStream& rStrm );
1059     virtual void        SaveXml( XclExpXmlStream& rStrm );
1060 
1061 private:
1062     typedef XclExpRecordList< XclExpNote >      XclExpNoteList;
1063     typedef XclExpRecordList< XclExpHyperlink > XclExpHyperlinkList;
1064 
1065     typedef ScfRef< XclExpDefrowheight >        XclExpDefrowhRef;
1066     typedef ScfRef< XclExpNoteList >            XclExpNoteListRef;
1067     typedef ScfRef< XclExpMergedcells >         XclExpMergedcellsRef;
1068     typedef ScfRef< XclExpHyperlinkList >       XclExpHyperlinkRef;
1069     typedef ScfRef< XclExpDval >                XclExpDvalRef;
1070 
1071     XclExpColinfoBuffer maColInfoBfr;       /// Buffer for column formatting.
1072     XclExpRowBuffer     maRowBfr;           /// Rows and cell records.
1073     XclExpArrayBuffer   maArrayBfr;         /// Buffer for ARRAY records.
1074     XclExpShrfmlaBuffer maShrfmlaBfr;       /// Buffer for SHRFMLA records.
1075     XclExpTableopBuffer maTableopBfr;       /// Buffer for TABLEOP records.
1076     XclExpDefrowhRef    mxDefrowheight;     /// DEFROWHEIGHT record for default row format.
1077     XclExpRecordRef     mxGuts;             /// GUTS record for outline areas.
1078     XclExpNoteListRef   mxNoteList;         /// List of NOTE records.
1079     XclExpMergedcellsRef mxMergedcells;     /// MERGEDCELLS record for merged cell ranges.
1080     XclExpHyperlinkRef  mxHyperlinkList;    /// List of HLINK records.
1081     XclExpDvalRef       mxDval;             /// Data validation with DVAL and DV records.
1082 };
1083 
1084 #endif
1085 
1086