Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_XEPIVOT_HXX
30 : : #define SC_XEPIVOT_HXX
31 : :
32 : : #include <map>
33 : : #include "xerecord.hxx"
34 : : #include "xlpivot.hxx"
35 : : #include "xeroot.hxx"
36 : :
37 : : class ScDPObject;
38 : : class ScDPSaveData;
39 : : class ScDPSaveDimension;
40 : : class ScDPSaveMember;
41 : : class ScDPSaveGroupDimension;
42 : : class ScDPSaveNumGroupDimension;
43 : : struct ScDPNumGroupInfo;
44 : :
45 : : // ============================================================================
46 : : // Pivot cache
47 : : // ============================================================================
48 : :
49 : : /** Represents a data item in a pivot cache containing data of any type. */
50 [ # # ][ # # ]: 0 : class XclExpPCItem : public XclExpRecord, public XclPCItem
[ # # ]
51 : : {
52 : : public:
53 : : explicit XclExpPCItem( const String& rText );
54 : : explicit XclExpPCItem( double fValue );
55 : : explicit XclExpPCItem( const DateTime& rDateTime );
56 : : explicit XclExpPCItem( sal_Int16 nValue );
57 : : explicit XclExpPCItem( bool bValue );
58 : :
59 : 0 : inline sal_uInt16 GetTypeFlag() const { return mnTypeFlag; }
60 : :
61 : : bool EqualsText( const rtl::OUString& rText ) const;
62 : : bool EqualsDouble( double fValue ) const;
63 : : bool EqualsDateTime( const DateTime& rDateTime ) const;
64 : : bool EqualsBool( bool bValue ) const;
65 : :
66 : : private:
67 : : virtual void WriteBody( XclExpStream& rStrm );
68 : :
69 : : private:
70 : : sal_uInt16 mnTypeFlag; /// Data type flag.
71 : : };
72 : :
73 : : // ============================================================================
74 : :
75 : : class XclExpPivotCache;
76 : :
77 : : class XclExpPCField : public XclExpRecord, public XclPCField, protected XclExpRoot
78 : : {
79 : : public:
80 : : /** Creates a standard pivot cache field, filled from sheet source data. */
81 : : explicit XclExpPCField( const XclExpRoot& rRoot,
82 : : const XclExpPivotCache& rPCache, sal_uInt16 nFieldIdx,
83 : : const ScDPObject& rDPObj, const ScRange& rRange );
84 : : /** Creates a child grouping pivot cache field, filled from the passed grouping info. */
85 : : explicit XclExpPCField( const XclExpRoot& rRoot,
86 : : const XclExpPivotCache& rPCache, sal_uInt16 nFieldIdx,
87 : : const ScDPObject& rDPObj, const ScDPSaveGroupDimension& rGroupDim,
88 : : const XclExpPCField& rBaseField );
89 : : virtual ~XclExpPCField();
90 : :
91 : : /** Sets the passed field as direct grouping child field of this field. */
92 : : void SetGroupChildField( const XclExpPCField& rChildField );
93 : : /** Converts this standard field into a numeric grouping field. */
94 : : void ConvertToNumGroup( const ScDPObject& rDPObj, const ScDPSaveNumGroupDimension& rNumGroupDim );
95 : :
96 : : /** Returns the name of this cache field. */
97 : 0 : inline const rtl::OUString& GetFieldName() const { return maFieldInfo.maName; }
98 : :
99 : : /** Returns the number of visible items of this field. */
100 : : sal_uInt16 GetItemCount() const;
101 : : /** Returns the specified pivot cache item (returns visible items in groupings). */
102 : : const XclExpPCItem* GetItem( sal_uInt16 nItemIdx ) const;
103 : : /** Returns the index of a pivot cache item, or EXC_PC_NOITEM on error. */
104 : : sal_uInt16 GetItemIndex( const rtl::OUString& rItemName ) const;
105 : :
106 : : /** Returns the size an item index needs to write out. */
107 : : sal_Size GetIndexSize() const;
108 : : /** Writes the item index at the passed source row position as part of the SXINDEXLIST record. */
109 : : void WriteIndex( XclExpStream& rStrm, sal_uInt32 nSrcRow ) const;
110 : :
111 : : /** Writes the pivot cache field and all items and other related records. */
112 : : virtual void Save( XclExpStream& rStrm );
113 : :
114 : : private:
115 : : typedef XclExpRecordList< XclExpPCItem > XclExpPCItemList;
116 : :
117 : : /** Returns the item list that contains the visible items.
118 : : @descr Visible items are equal to source items in standard fields,
119 : : but are generated items in grouping and calculated fields. */
120 : : const XclExpPCItemList& GetVisItemList() const;
121 : :
122 : : /** Initializes a standard field. Inserts all original source items. */
123 : : void InitStandardField( const ScRange& rRange );
124 : : /** Initializes a standard grouping field. Inserts all visible grouping items. */
125 : : void InitStdGroupField( const XclExpPCField& rBaseField, const ScDPSaveGroupDimension& rGroupDim );
126 : : /** Initializes a numeric grouping field. Inserts all visible grouping items and the limit settings. */
127 : : void InitNumGroupField( const ScDPObject& rDPObj, const ScDPNumGroupInfo& rNumInfo );
128 : : /** Initializes a date grouping field. Inserts all visible grouping items and the limit settings. */
129 : : void InitDateGroupField( const ScDPObject& rDPObj, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nDatePart );
130 : :
131 : : /** Inserts the passed index into the item index array of original items. */
132 : : void InsertItemArrayIndex( size_t nListPos );
133 : : /** Inserts an original source item. Updates item index array. */
134 : : void InsertOrigItem( XclExpPCItem* pNewItem );
135 : : /** Inserts an original text item, if it is not contained already. */
136 : : void InsertOrigTextItem( const String& rText );
137 : : /** Inserts an original value item, if it is not contained already. */
138 : : void InsertOrigDoubleItem( double fValue );
139 : : /** Inserts an original date/time item, if it is not contained already. */
140 : : void InsertOrigDateTimeItem( const DateTime& rDateTime );
141 : : /** Inserts an original boolean item, if it is not contained already. */
142 : : void InsertOrigBoolItem( bool bValue );
143 : :
144 : : /** Inserts an item into the grouping item list. Does not change anything else.
145 : : @return The list index of the new item. */
146 : : sal_uInt16 InsertGroupItem( XclExpPCItem* pNewItem );
147 : : /** Generates and inserts all visible items for numeric or date grouping. */
148 : : void InsertNumDateGroupItems( const ScDPObject& rDPObj, const ScDPNumGroupInfo& rNumInfo, sal_Int32 nDatePart = 0 );
149 : :
150 : : /** Inserts the SXDOUBLE items that specify the limits for a numeric grouping. */
151 : : void SetNumGroupLimit( const ScDPNumGroupInfo& rNumInfo );
152 : : /** Inserts the SXDATETIME/SXINTEGER items that specify the limits for a date grouping.
153 : : @param bUseStep true = Insert the passed step value; false = always insert 1. */
154 : : void SetDateGroupLimit( const ScDPNumGroupInfo& rDateInfo, bool bUseStep );
155 : :
156 : : /** Initializes flags and item count fields. */
157 : : void Finalize();
158 : :
159 : : /** Writes an SXNUMGROUP record and the additional items for a numeric grouping field. */
160 : : void WriteSxnumgroup( XclExpStream& rStrm );
161 : : /** Writes an SXGROUPINFO record describing the item order in grouping fields. */
162 : : void WriteSxgroupinfo( XclExpStream& rStrm );
163 : :
164 : : /** Writes the contents of the SXFIELD record for this field. */
165 : : virtual void WriteBody( XclExpStream& rStrm );
166 : :
167 : : private:
168 : : const XclExpPivotCache& mrPCache; /// Parent pivot cache containing this field.
169 : : XclExpPCItemList maOrigItemList; /// List with original items.
170 : : XclExpPCItemList maGroupItemList; /// List with grouping items.
171 : : ScfUInt16Vec maIndexVec; /// Indexes into maItemList.
172 : : XclExpPCItemList maNumGroupLimits; /// List with limit values for numeric grouping.
173 : : sal_uInt16 mnTypeFlags; /// Collected item data type flags.
174 : : };
175 : :
176 : : // ============================================================================
177 : :
178 [ # # ][ # # ]: 0 : class XclExpPivotCache : protected XclExpRoot
179 : : {
180 : : public:
181 : : explicit XclExpPivotCache( const XclExpRoot& rRoot,
182 : : const ScDPObject& rDPObj, sal_uInt16 nListIdx );
183 : :
184 : : /** Returns true, if the cache has been constructed successfully. */
185 : 0 : inline bool IsValid() const { return mbValid; }
186 : : /** Returns true, if the item index list will be written. */
187 : : bool HasItemIndexList() const;
188 : :
189 : : /** Returns the stream identifier used to create the cache stream. */
190 : : inline sal_uInt16 GetStreamId() const { return maPCInfo.mnStrmId; }
191 : : /** Returns the list index of the cache used in pivot table records. */
192 : 0 : inline sal_uInt16 GetCacheIndex() const { return mnListIdx; }
193 : :
194 : : /** Returns the number of pivot cache fields. */
195 : : sal_uInt16 GetFieldCount() const;
196 : : /** Returns the specified pivot cache field. */
197 : : const XclExpPCField* GetField( sal_uInt16 nFieldIdx ) const;
198 : : /** Returns true, if this pivot cache contains non-standard fields (e.g. grouping fields). */
199 : : bool HasAddFields() const;
200 : :
201 : : /** Returns true, if the passed DP object has the same data source as this cache. */
202 : : bool HasEqualDataSource( const ScDPObject& rDPObj ) const;
203 : :
204 : : /** Writes related records into Workbook stream and creates the pivot cache storage stream. */
205 : : virtual void Save( XclExpStream& rStrm );
206 : : virtual void SaveXml( XclExpXmlStream& rStrm );
207 : :
208 : : private:
209 : : /** Returns read/write access to a pivot cache field. */
210 : : XclExpPCField* GetFieldAcc( sal_uInt16 nFieldIdx );
211 : : /** Returns read/write access to a pivot cache field. */
212 : : XclExpPCField* GetFieldAcc( const rtl::OUString& rFieldName );
213 : :
214 : : /** Adds all pivot cache fields. */
215 : : void AddFields( const ScDPObject& rDPObj );
216 : :
217 : : /** Adds all standard pivot cache fields based on source data. */
218 : : void AddStdFields( const ScDPObject& rDPObj );
219 : : /** Adds all grouping pivot cache fields. */
220 : : void AddGroupFields( const ScDPObject& rDPObj );
221 : : /** Adds all calculated pivot cache fields. */
222 : : void AddCalcFields( const ScDPObject& rDPObj );
223 : :
224 : : /** Writes the DCONREF record containing the source range. */
225 : : void WriteDconref( XclExpStream& rStrm ) const;
226 : : /** DCONNAME record contains range name source. */
227 : : void WriteDConName( XclExpStream& rStrm ) const;
228 : :
229 : : /** Creates the pivot cache storage stream and writes the cache. */
230 : : void WriteCacheStream();
231 : : /** Writes the SXDB record. */
232 : : void WriteSxdb( XclExpStream& rStrm ) const;
233 : : /** Writes the SXDBEX record. */
234 : : void WriteSxdbex( XclExpStream& rStrm ) const;
235 : : /** Writes the SXINDEXLIST record list containing the item index table. */
236 : : void WriteSxindexlistList( XclExpStream& rStrm ) const;
237 : :
238 : : private:
239 : : typedef XclExpRecordList< XclExpPCField > XclExpPCFieldList;
240 : : typedef XclExpPCFieldList::RecordRefType XclExpPCFieldRef;
241 : :
242 : : XclPCInfo maPCInfo; /// Pivot cache settings (SXDB record).
243 : : XclExpPCFieldList maFieldList; /// List of all pivot cache fields.
244 : : rtl::OUString maTabName; /// Name of source data sheet.
245 : : rtl::OUString maSrcRangeName; /// Range name for source data.
246 : : ScRange maOrigSrcRange; /// The original sheet source range.
247 : : ScRange maExpSrcRange; /// The exported sheet source range.
248 : : ScRange maDocSrcRange; /// The range used to build the cache fields and items.
249 : : sal_uInt16 mnListIdx; /// List index in pivot cache buffer.
250 : : bool mbValid; /// true = The cache is valid for export.
251 : : };
252 : :
253 : : // ============================================================================
254 : : // Pivot table
255 : : // ============================================================================
256 : :
257 : : class XclExpPivotTable;
258 : :
259 : : /** Data field position specifying the pivot table field index (first) and data info index (second). */
260 : : typedef ::std::pair< sal_uInt16, sal_uInt16 > XclPTDataFieldPos;
261 : :
262 : : // ============================================================================
263 : :
264 [ # # ]: 0 : class XclExpPTItem : public XclExpRecord
265 : : {
266 : : public:
267 : : explicit XclExpPTItem( const XclExpPCField& rCacheField, sal_uInt16 nCacheIdx );
268 : : explicit XclExpPTItem( sal_uInt16 nItemType, sal_uInt16 nCacheIdx, bool bUseCache );
269 : :
270 : : /** Returns the internal name of this item. */
271 : : rtl::OUString GetItemName() const;
272 : :
273 : : /** Fills this item with properties from the passed save member. */
274 : : void SetPropertiesFromMember( const ScDPSaveMember& rSaveMem );
275 : :
276 : : private:
277 : : /** Writes the SXVI record body describing the pivot table item. */
278 : : virtual void WriteBody( XclExpStream& rStrm );
279 : :
280 : : private:
281 : : const XclExpPCItem* mpCacheItem; /// The referred pivot cache item.
282 : : XclPTItemInfo maItemInfo; /// General data for this item.
283 : : };
284 : :
285 : : // ============================================================================
286 : :
287 [ # # ][ # # ]: 0 : class XclExpPTField : public XclExpRecordBase
[ # # ]
288 : : {
289 : : public:
290 : : explicit XclExpPTField( const XclExpPivotTable& rPTable, sal_uInt16 nCacheIdx );
291 : :
292 : : // data access ------------------------------------------------------------
293 : :
294 : : /** Returns the name of this field. */
295 : : rtl::OUString GetFieldName() const;
296 : : /** Returns the pivot table field list index of this field. */
297 : : sal_uInt16 GetFieldIndex() const;
298 : :
299 : : /** Returns the index of the last inserted data info struct. */
300 : : sal_uInt16 GetLastDataInfoIndex() const;
301 : :
302 : : /** Returns the list index of an item by its name.
303 : : @param nDefaultIdx This value will be returned, if the item could not be found. */
304 : : sal_uInt16 GetItemIndex( const rtl::OUString& rName, sal_uInt16 nDefaultIdx ) const;
305 : :
306 : : // fill data --------------------------------------------------------------
307 : :
308 : : /** Fills this field with row/column/page properties from the passed save dimension. */
309 : : void SetPropertiesFromDim( const ScDPSaveDimension& rSaveDim );
310 : : /** Fills this field with data field properties from the passed save dimension. */
311 : : void SetDataPropertiesFromDim( const ScDPSaveDimension& rSaveDim );
312 : :
313 : : /** Appends special items describing the field subtotal entries. */
314 : : void AppendSubtotalItems();
315 : :
316 : : // records ----------------------------------------------------------------
317 : :
318 : : /** Writes an entry for an SXPI record containing own page field info. */
319 : : void WriteSxpiEntry( XclExpStream& rStrm ) const;
320 : : /** Writes an SXDI records containing info about a data field. */
321 : : void WriteSxdi( XclExpStream& rStrm, sal_uInt16 nDataInfoIdx ) const;
322 : :
323 : : /** Writes the entire pivot table field. */
324 : : virtual void Save( XclExpStream& rStrm );
325 : :
326 : : // ------------------------------------------------------------------------
327 : : private:
328 : : /** Returns an item by its name. */
329 : : XclExpPTItem* GetItemAcc( const rtl::OUString& rName );
330 : :
331 : : /** Appends a special item describing a field subtotal entry. */
332 : : void AppendSubtotalItem( sal_uInt16 nItemType );
333 : :
334 : : /** Writes the SXVD record introducing the field. */
335 : : void WriteSxvd( XclExpStream& rStrm ) const;
336 : : /** Writes the SXVDEX record containing additional settings. */
337 : : void WriteSxvdex( XclExpStream& rStrm ) const;
338 : :
339 : : private:
340 : : typedef ::std::vector< XclPTDataFieldInfo > XclPTDataFieldInfoVec;
341 : : typedef XclExpRecordList< XclExpPTItem > XclExpPTItemList;
342 : :
343 : : const XclExpPivotTable& mrPTable; /// Parent pivot table containing this field.
344 : : const XclExpPCField* mpCacheField; /// The referred pivot cache field.
345 : : XclPTFieldInfo maFieldInfo; /// General field info (SXVD record).
346 : : XclPTFieldExtInfo maFieldExtInfo; /// Extended field info (SXVDEX record).
347 : : XclPTPageFieldInfo maPageInfo; /// Page field info (entry in SXPI record).
348 : : XclPTDataFieldInfoVec maDataInfoVec; /// List of extended data field info (SXDI records).
349 : : XclExpPTItemList maItemList; /// List of all items of this field.
350 : : };
351 : :
352 : : // ============================================================================
353 : :
354 [ # # ][ # # ]: 0 : class XclExpPivotTable : public XclExpRecordBase, protected XclExpRoot
[ # # ][ # # ]
355 : : {
356 : : public:
357 : : explicit XclExpPivotTable( const XclExpRoot& rRoot,
358 : : const ScDPObject& rDPObj, const XclExpPivotCache& rPCache );
359 : :
360 : : /** Returns a pivot cache field. */
361 : : const XclExpPCField* GetCacheField( sal_uInt16 nCacheIdx ) const;
362 : :
363 : : /** Returns the output range of the pivot table. */
364 : 0 : inline SCTAB GetScTab() const { return mnOutScTab; }
365 : :
366 : : /** Returns a pivot table field by its name. */
367 : : const XclExpPTField* GetField( sal_uInt16 nFieldIdx ) const;
368 : : /** Returns a pivot table field by its name. */
369 : : const XclExpPTField* GetField( const rtl::OUString& rName ) const;
370 : :
371 : : /** Returns the data-field-only index of the first data field with the passed name.
372 : : @param nDefaultIdx This value will be returned, if the field could not be found. */
373 : : sal_uInt16 GetDataFieldIndex( const rtl::OUString& rName, sal_uInt16 nDefaultIdx ) const;
374 : :
375 : : /** Writes the entire pivot table. */
376 : : virtual void Save( XclExpStream& rStrm );
377 : : virtual void SaveXml( XclExpXmlStream& rStrm );
378 : :
379 : : // ------------------------------------------------------------------------
380 : : private:
381 : : /** Returns a pivot table field by its name. */
382 : : XclExpPTField* GetFieldAcc( const rtl::OUString& rName );
383 : : /** Returns a pivot table field corresponding to the passed save dimension. */
384 : : XclExpPTField* GetFieldAcc( const ScDPSaveDimension& rSaveDim );
385 : :
386 : : // fill data --------------------------------------------------------------
387 : :
388 : : /** Fills internal members with all properties from the passed save data. */
389 : : void SetPropertiesFromDP( const ScDPSaveData& rSaveData );
390 : : /** Fills a pivot table field with all properties from the passed save dimension. */
391 : : void SetFieldPropertiesFromDim( const ScDPSaveDimension& rSaveDim );
392 : : /** Fills a pivot table data field with all properties from the passed save dimension. */
393 : : void SetDataFieldPropertiesFromDim( const ScDPSaveDimension& rSaveDim );
394 : :
395 : : /** Initializes any data after processing the entire source DataPilot. */
396 : : void Finalize();
397 : :
398 : : // records ----------------------------------------------------------------
399 : :
400 : : /** Writes the SXVIEW record starting the pivot table. */
401 : : void WriteSxview( XclExpStream& rStrm ) const;
402 : : /** Writes an SXIVD record for row field or column field order. */
403 : : void WriteSxivd( XclExpStream& rStrm, const ScfUInt16Vec& rFields ) const;
404 : : /** Writes the SXPI record containing page field info. */
405 : : void WriteSxpi( XclExpStream& rStrm ) const;
406 : : /** Writes all SXDI records containing info about the data fields. */
407 : : void WriteSxdiList( XclExpStream& rStrm ) const;
408 : : /** Writes a dummy SXLI records containing item layout info. */
409 : : void WriteSxli( XclExpStream& rStrm, sal_uInt16 nLineCount, sal_uInt16 nIndexCount ) const;
410 : : /** Writes the SXEX records containing additional pivot table info. */
411 : : void WriteSxex( XclExpStream& rStrm ) const;
412 : :
413 : : void WriteQsiSxTag( XclExpStream& rStrm ) const;
414 : : /** Writes the SX_AUTOFORMAT records with the autoformat id and header layout */
415 : : void WriteSxViewEx9( XclExpStream& rStrm ) const;
416 : :
417 : : // ------------------------------------------------------------------------
418 : : private:
419 : : typedef XclExpRecordList< XclExpPTField > XclExpPTFieldList;
420 : : typedef XclExpPTFieldList::RecordRefType XclExpPTFieldRef;
421 : : typedef ::std::vector< XclPTDataFieldPos > XclPTDataFieldPosVec;
422 : :
423 : : const XclExpPivotCache& mrPCache; /// The pivot cache this pivot table bases on.
424 : : XclPTInfo maPTInfo; /// Info about the pivot table (SXVIEW record).
425 : : XclPTExtInfo maPTExtInfo; /// Extended info about the pivot table (SXEX record).
426 : : XclPTViewEx9Info maPTViewEx9Info; /// The selected autoformat (SXVIEWEX9)
427 : : XclExpPTFieldList maFieldList; /// All fields in pivot cache order.
428 : : ScfUInt16Vec maRowFields; /// Row field indexes.
429 : : ScfUInt16Vec maColFields; /// Column field indexes.
430 : : ScfUInt16Vec maPageFields; /// Page field indexes.
431 : : XclPTDataFieldPosVec maDataFields; /// Data field indexes.
432 : : XclExpPTField maDataOrientField; /// Special data field orientation field.
433 : : SCTAB mnOutScTab; /// Sheet index of the output range.
434 : : bool mbValid; /// true = The pivot table is valid for export.
435 : : bool mbFilterBtn; /// true = DataPilot has filter button.
436 : : };
437 : :
438 : : // ============================================================================
439 : :
440 : : /** The main class for pivot table export.
441 : :
442 : : This class contains all pivot caches and pivot tables in a Calc document.
443 : : It creates the pivot cache streams and pivot table records in the main
444 : : workbook stream. It supports sharing of pivot caches between multiple pivot
445 : : tables to decrease file size.
446 : : */
447 [ # # ][ # # ]: 0 : class XclExpPivotTableManager : protected XclExpRoot
[ # # ]
448 : : {
449 : : public:
450 : : explicit XclExpPivotTableManager( const XclExpRoot& rRoot );
451 : :
452 : : /** Creates all pivot tables and caches from the Calc DataPilot objects. */
453 : : void CreatePivotTables();
454 : :
455 : : /** Creates a record wrapper for exporting all pivot caches. */
456 : : XclExpRecordRef CreatePivotCachesRecord();
457 : : /** Creates a record wrapper for exporting all pivot tables of the specified sheet. */
458 : : XclExpRecordRef CreatePivotTablesRecord( SCTAB nScTab );
459 : :
460 : : /** Writes all pivot caches (all Workbook records and cache streams). */
461 : : void WritePivotCaches( XclExpStream& rStrm );
462 : : void WritePivotCachesXml( XclExpXmlStream& rStrm );
463 : : /** Writes all pivot tables of the specified Calc sheet. */
464 : : void WritePivotTables( XclExpStream& rStrm, SCTAB nScTab );
465 : : void WritePivotTablesXml( XclExpXmlStream& rStrm, SCTAB nScTab );
466 : :
467 : : private:
468 : : /** Finds an existing (if enabled in mbShareCaches) or creates a new pivot cache.
469 : : @return Pointer to the pivot cache or 0, if the passed source range was invalid. */
470 : : const XclExpPivotCache* CreatePivotCache( const ScDPObject& rDPObj );
471 : :
472 : : private:
473 : : typedef XclExpRecordList< XclExpPivotCache > XclExpPivotCacheList;
474 : : typedef XclExpPivotCacheList::RecordRefType XclExpPivotCacheRef;
475 : : typedef XclExpRecordList< XclExpPivotTable > XclExpPivotTableList;
476 : : typedef XclExpPivotTableList::RecordRefType XclExpPivotTableRef;
477 : :
478 : : XclExpPivotCacheList maPCacheList; /// List of all pivot caches.
479 : : XclExpPivotTableList maPTableList; /// List of all pivot tables.
480 : : bool mbShareCaches; /// true = Tries to share caches between tables.
481 : : };
482 : :
483 : : // ============================================================================
484 : :
485 : : #endif
486 : :
487 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|