LibreOffice Module sc (master)  1
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at .
18  */
20 #pragma once
22 #include "pivotcachebuffer.hxx"
23 #include "stylesbuffer.hxx"
25 namespace com::sun::star {
26  namespace sheet { class XDataPilotDescriptor; }
27  namespace sheet { class XDataPilotField; }
28 }
30 class ScDPObject;
32 namespace oox::xls {
34 class PivotTable;
37 {
38  sal_Int32 mnCacheItem;
39  sal_Int32 mnType;
40  OUString msCaption;
42  bool mbHidden;
44  explicit PTFieldItemModel();
47  void setBiffType( sal_uInt16 nType );
48 };
51 {
52  sal_Int32 mnAxis;
53  sal_Int32 mnNumFmtId;
54  sal_Int32 mnAutoShowItems;
55  sal_Int32 mnAutoShowRankBy;
56  sal_Int32 mnSortType;
57  sal_Int32 mnSortRefField;
58  sal_Int32 mnSortRefItem;
59  bool mbDataField;
72  bool mbShowAll;
73  bool mbOutline;
77  bool mbAutoShow;
81  explicit PTFieldModel();
84  void setBiffAxis( sal_uInt8 nAxisFlags );
85 };
88 {
89  OUString maName;
90  sal_Int32 mnField;
91  sal_Int32 mnItem;
93  explicit PTPageFieldModel();
94 };
97 {
98  OUString maName;
99  sal_Int32 mnField;
100  sal_Int32 mnSubtotal;
101  sal_Int32 mnShowDataAs;
102  sal_Int32 mnBaseField;
103  sal_Int32 mnBaseItem;
104  sal_Int32 mnNumFmtId;
106  explicit PTDataFieldModel();
109  void setBiffSubtotal( sal_Int32 nSubtotal );
111  void setBiffShowDataAs( sal_Int32 nShowDataAs );
112 };
115 {
116 public:
117  explicit PivotTableField( PivotTable& rPivotTable, sal_Int32 nFieldIndex );
120  void importPivotField( const AttributeList& rAttribs );
122  void importItem( const AttributeList& rAttribs );
124  void importReference( const AttributeList& rAttribs );
126  void importReferenceItem( const AttributeList& rAttribs );
131  void importPTFItem( SequenceInputStream& rStrm );
133  void importPTReference( SequenceInputStream& rStrm );
138  void finalizeImport(
139  const css::uno::Reference< css::sheet::XDataPilotDescriptor >& rxDPDesc );
142  const css::uno::Reference< css::sheet::XDataPilotField >& rxBaseDPField,
143  sal_Int32 nBaseFieldIdx );
146  const css::uno::Reference< css::sheet::XDataPilotField >& rxBaseDPField,
147  const PivotCacheField& rBaseCacheField,
148  PivotCacheGroupItemVector& orItemNames );
150  const css::uno::Reference< css::sheet::XDataPilotDescriptor >& rxDPDesc);
153  const OUString& getDPFieldName() const { return maDPFieldName; }
156  void convertRowField();
158  void convertColField();
160  void convertHiddenField();
162  void convertPageField( const PTPageFieldModel& rPageField );
164  void convertDataField( const PTDataFieldModel& rDataField );
166 private:
168  css::uno::Reference< css::sheet::XDataPilotField >
169  convertRowColPageField( sal_Int32 nAxis );
171 private:
172  typedef ::std::vector< PTFieldItemModel > ItemModelVector;
175  ItemModelVector maItems;
177  OUString maDPFieldName;
178  sal_Int32 mnFieldIndex;
179 };
182 {
183  OUString maName;
184  OUString maDescription;
185  OUString maStrValue1;
186  OUString maStrValue2;
187  double mfValue;
188  sal_Int32 mnField;
189  sal_Int32 mnMemPropField;
190  sal_Int32 mnType;
191  sal_Int32 mnEvalOrder;
192  sal_Int32 mnId;
193  sal_Int32 mnMeasureField;
194  sal_Int32 mnMeasureHier;
195  bool mbTopFilter;
197  explicit PTFilterModel();
198 };
201 {
202 public:
203  explicit PivotTableFilter( const PivotTable& rPivotTable );
206  void importFilter( const AttributeList& rAttribs );
208  void importTop10( const AttributeList& rAttribs );
213  void importTop10Filter( SequenceInputStream& rStrm );
216  void finalizeImport();
218 private:
221 };
224 {
225  OUString maName;
226  OUString maDataCaption;
230  OUString maErrorCaption;
232  OUString maPageStyle;
234  OUString maVacatedStyle;
235  OUString maTag;
236  sal_Int32 mnCacheId;
237  sal_Int32 mnDataPosition;
238  sal_Int32 mnPageWrap;
239  sal_Int32 mnIndent;
240  sal_Int32 mnChartFormat;
266  explicit PTDefinitionModel();
267 };
270 {
272  sal_Int32 mnFirstHeaderRow;
273  sal_Int32 mnFirstDataRow;
274  sal_Int32 mnFirstDataCol;
275  sal_Int32 mnRowPageCount;
276  sal_Int32 mnColPageCount;
278  explicit PTLocationModel();
279 };
282 {
283 public:
284  explicit PivotTable( const WorkbookHelper& rHelper );
287  void importPivotTableDefinition( const AttributeList& rAttribs );
289  void importLocation( const AttributeList& rAttribs, sal_Int16 nSheet );
291  void importRowField( const AttributeList& rAttribs );
293  void importColField( const AttributeList& rAttribs );
295  void importPageField( const AttributeList& rAttribs );
297  void importDataField( const AttributeList& rAttribs );
299  void putToInteropGrabBag(const OUString& sName, const AttributeList& rAttribs);
304  void importPTLocation( SequenceInputStream& rStrm, sal_Int16 nSheet );
306  void importPTRowFields( SequenceInputStream& rStrm );
308  void importPTColFields( SequenceInputStream& rStrm );
310  void importPTPageField( SequenceInputStream& rStrm );
312  void importPTDataField( SequenceInputStream& rStrm );
319  void finalizeImport();
321  void finalizeFieldsImport();
324  const css::uno::Reference< css::sheet::XDataPilotField >& rxBaseDPField,
325  sal_Int32 nBaseFieldIdx );
328  const css::uno::Reference< css::sheet::XDataPilotField >& rxBaseDPField,
329  const PivotCacheField& rBaseCacheField,
330  PivotCacheGroupItemVector& orItemNames );
333  css::uno::Reference< css::sheet::XDataPilotField >
334  getDataPilotField( const OUString& rFieldName ) const;
336  css::uno::Reference< css::sheet::XDataPilotField >
337  getDataPilotField( sal_Int32 nFieldIdx ) const;
339  css::uno::Reference< css::sheet::XDataPilotField >
340  getDataLayoutField() const;
343  PivotCacheField* getCacheField( sal_Int32 nFieldIdx );
344  const PivotCacheField* getCacheField( sal_Int32 nFieldIdx ) const;
346  const PivotCacheField* getCacheFieldOfDataField( sal_Int32 nDataItemIdx ) const;
348  sal_Int32 getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const;
352 private:
355  typedef ::std::vector< sal_Int32 > IndexVector;
356  typedef ::std::vector< PTPageFieldModel > PageFieldVector;
357  typedef ::std::vector< PTDataFieldModel > DataFieldVector;
359 private:
361  PivotTableField* getTableField( sal_Int32 nFieldIdx );
364  static void importField( IndexVector& orFields, const AttributeList& rAttribs );
366  static void importFields( IndexVector& orFields, SequenceInputStream& rStrm );
368 private:
370  PivotTableFieldVector maFields;
372  IndexVector maRowFields;
373  IndexVector maColFields;
374  PageFieldVector maPageFields;
375  DataFieldVector maDataFields;
376  PivotTableFilterVector maFilters;
380  css::uno::Reference< css::sheet::XDataPilotDescriptor >
382  std::map<OUString, css::uno::Any> maInteropGrabBag;
384 };
387 {
388 public:
389  explicit PivotTableBuffer( const WorkbookHelper& rHelper );
395  void finalizeImport();
397 private:
399  PivotTableVector maTables;
400 };
402 } // namespace oox::xls
404 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 mnEvalOrder
Filter type.
Helper class to provide access to global workbook data.
void convertHiddenField()
Converts dimension and other settings for a hidden field.
void setBiffType(sal_uInt16 nType)
Sets item type for BIFF import.
bool mbProductSubtotal
True = show minimum subtotals.
void finalizeImport()
Inserts the pivot table into the sheet.
bool mbTopFilter
Hierarchy for filter calculation.
std::map< OUString, css::uno::Any > maInteropGrabBag
Descriptor of the DataPilot object.
PivotCache * mpPivotCache
Location settings of the pivot table.
ItemModelVector maItems
The parent pivot table object.
bool mbMultiPageItems
True = auto show filter shows top entries, false = bottom.
ScDPObject * getDPObject()
bool mbTopAutoShow
True = auto show (top 10) filter enabled.
sal_Int32 mnField
Unique name of the page field.
void finalizeParentGroupingImport(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField, const PivotCacheField &rBaseCacheField, PivotCacheGroupItemVector &orItemNames)
Finalizes the grouped field after import.
void finalizeImport()
Inserts all pivot tables into the sheet.
sal_Int32 mnMeasureField
Unique identifier.
sal_Int32 mnSortRefItem
Reference field for autosorting.
True = filter shows top entries, false = bottom.
bool mbStdDevPSubtotal
True = show standard deviation subtotals.
void importRowField(const AttributeList &rAttribs)
Reads the index of a field located in the row dimension.
void importPTReferenceItem(SequenceInputStream &rStrm)
Imports pivot field item reference settings from the PTREFERENCEITEM record.
sal_Int32 mnFieldIndex
Name of the field in DataPilot field collection.
OUString maStrValue2
First string value for label filter.
sal_Int32 mnFirstDataCol
First row of data cells (relative in pivot table).
::std::vector< sal_Int32 > IndexVector
void finalizeDateGroupingImport(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField, sal_Int32 nBaseFieldIdx)
Creates all date group fields for the specified cache field after import.
const PivotTable & mrPivotTable
void importColField(const AttributeList &rAttribs)
Reads the index of a field located in the column dimension.
css::uno::Reference< css::sheet::XDataPilotField > convertRowColPageField(sal_Int32 nAxis)
Converts dimension and other settings for row, column, page, or hidden fields.
exports sheet
void importDataField(const AttributeList &rAttribs)
Reads the settings of a field located in the data dimension from the dataField element.
void importPTFItem(SequenceInputStream &rStrm)
Imports settings of an item in this pivot field from the PTFITEM record.
bool mbOutline
True = show items without data.
::std::vector< PTFieldItemModel > ItemModelVector
sal_Int32 mnItem
Base pivot field.
sal_Int32 mnSubtotal
Base pivot field.
True = multiple items selectable in page dimension.
static void importFields(IndexVector &orFields, SequenceInputStream &rStrm)
Reads an array of field indexes for the row or column dimension.
sal_Int32 mnFirstDataRow
First row of header cells (relative in pivot table).
void importLocation(const AttributeList &rAttribs, sal_Int16 nSheet)
Reads the location of the pivot table from the location element.
sal_Int32 mnColPageCount
Number of rows in page filter area.
void finalizeImport(const css::uno::Reference< css::sheet::XDataPilotDescriptor > &rxDPDesc)
Finalizes the field after import, creates grouping and other settings.
css::uno::Reference< css::sheet::XDataPilotDescriptor > mxDPDescriptor
The pivot cache this table is based on.
sal_Int32 mnField
Number of items or percent or sum to be shown.
void setBiffSubtotal(sal_Int32 nSubtotal)
Sets the subtotal aggregation function for BIFF import.
void setBiffShowDataAs(sal_Int32 nShowDataAs)
Sets the 'show data as' type for BIFF import.
void importTop10Filter(SequenceInputStream &rStrm)
Reads additional settings of a field filter from the TOP10FILTER record.
void finalizeFieldsImport()
Finalizes all fields, finds field names and creates grouping fields.
const char * sName
bool mbHidden
True = show item details (items of child fields).
bool mbInsertBlankRow
True = show subtotals on top of items in outline or compact mode.
void importPivotTableDefinition(const AttributeList &rAttribs)
Reads global pivot table settings from the pivotTableDefinition element.
void importPageField(const AttributeList &rAttribs)
Reads the settings of a field located in the page dimension from the pageField element.
bool mbInsertPageBreak
True = insert blank rows after items.
bool mbCountASubtotal
True = show sum subtotals.
bool mbDataField
Item in reference field for autosorting.
sal_Int32 getCacheDatabaseIndex(sal_Int32 nFieldIdx) const
Returns the source column index of the pivot field with the passed index, or -1.
double mfValue
Second string value for label filter.
void importPTPageField(SequenceInputStream &rStrm)
Reads the settings of a field located in the page dimension from the PTPAGEFIELD record.
sal_Int32 mnFirstHeaderRow
Target cell range for the pivot table.
True = item is hidden.
IndexVector maRowFields
Data layout field.
void importFilter(const AttributeList &rAttribs)
Reads the settings of a field filter from the filter element.
::std::vector< PTPageFieldModel > PageFieldVector
bool mbAutoShow
True = insert page breaks after items.
PTLocationModel maLocationModel
Global pivot table settings.
static void importField(IndexVector &orFields, const AttributeList &rAttribs)
Reads a field index for the row or column dimension.
PivotTableFieldVector maFields
const PivotCacheField * getCacheFieldOfDataField(sal_Int32 nDataItemIdx) const
Returns the base cache field of the data field item with the specified index.
PivotTable(const WorkbookHelper &rHelper)
void finalizeImport()
Applies the filter to the associated pivot table field if possible.
sal_Int32 mnShowDataAs
Subtotal aggregation function.
sal_Int32 mnNumFmtId
Base item for 'show data as'.
bool mbSubtotalTop
True = show in outline view, false = show in tabular view.
RefVector< PivotTableField > PivotTableFieldVector
void putToInteropGrabBag(const OUString &sName, const AttributeList &rAttribs)
Puts the attributes to the named grab bag value.
void importPTRowFields(SequenceInputStream &rStrm)
Reads the indexes of all fields located in the row dimension from a PTROWFIELDS record.
bool mbShowAll
True = show variance of population subtotals.
sal_Int32 mnAutoShowRankBy
Number of items (or percent/sum) to be shown in auto show filter.
css::uno::Reference< css::sheet::XDataPilotField > getDataPilotField(const OUString &rFieldName) const
Returns the associated data pilot field for the specified pivot table field.
sal_Int32 mnType
Member property field.
void finalizeParentGroupingImport(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField, const PivotCacheField &rBaseCacheField, PivotCacheGroupItemVector &orItemNames)
Creates all grouped fields for the specified cache field after import.
void importPTDefinition(SequenceInputStream &rStrm)
Reads global pivot table settings from the PTDEFINITION record.
void convertPageField(const PTPageFieldModel &rPageField)
Converts dimension and other settings for a page field.
void setBiffAxis(sal_uInt8 nAxisFlags)
Sets axis type for BIFF import.
css::uno::Reference< css::sheet::XDataPilotField > getDataLayoutField() const
Returns the data layout field used to store all data fields in row/col dimension. ...
bool mbStdDevSubtotal
True = show count numbers subtotals.
bool mbMaxSubtotal
True = show average subtotals.
OUString maDPFieldName
Pivot field settings.
Index of field item that is shown by the page field.
PivotTableField & createTableField()
Creates and returns a new pivot table field.
void importPTLocation(SequenceInputStream &rStrm, sal_Int16 nSheet)
Reads the location of the pivot table from the PTLOCATION record.
void importPTDataField(SequenceInputStream &rStrm)
Reads the settings of a field located in the data dimension from the PTDATAFIELD record.
bool mbVarSubtotal
True = show standard deviation of population subtotals.
PivotTableFilterVector maFilters
Settings for all fields in data area.
void convertDataField(const PTDataFieldModel &rDataField)
Converts dimension and other settings for a data field.
sal_Int32 mnMeasureHier
Data field for filter calculation.
DataFieldVector maDataFields
Settings for all fields in page dimension.
sal_Int32 mnBaseField
Show data as, based on another field.
void importPTField(SequenceInputStream &rStrm)
Imports pivot field settings from the PTFIELD record.
void importTop10(const AttributeList &rAttribs)
Reads additional settings of a field filter from the top10 element.
unsigned char sal_uInt8
bool mbShowDetails
User caption of the item.
::std::vector< PTDataFieldModel > DataFieldVector
sal_Int32 mnSortType
Index of the data field auto show filter is based on.
sal_Int32 mnNumFmtId
Axis this field is assigned to (none, row, column, page).
PivotTableField maDataField
All pivot table fields.
OUString msCaption
Type of the item.
void importItem(const AttributeList &rAttribs)
Imports settings of an item in this pivot field from the item element.
sal_Int32 mnRowPageCount
First column of data cells (relative in pivot table).
void convertColField()
Converts dimension and other settings for a column field.
void importReferenceItem(const AttributeList &rAttribs)
Imports pivot field item reference settings from the x element.
PTDefinitionModel maDefModel
All field filters.
bool mbVarPSubtotal
True = show variance subtotals.
Definition: qproform.cxx:398
bool mbSumSubtotal
True = show default subtotals.
PivotTable & createPivotTable()
Creates and returns a new pivot table.
OUString maStrValue1
Description of the field filter.
sal_Int32 mnAutoShowItems
Number format for field items.
IndexVector maColFields
Indexes to fields in row dimension.
PivotCacheField * getCacheField(sal_Int32 nFieldIdx)
Returns the cache field with the specified index.
sal_Int32 mnId
Evaluation order index.
void importReference(const AttributeList &rAttribs)
Imports pivot field reference settings from the reference element.
sal_Int32 mnMemPropField
Base pivot field.
sal_Int32 mnSortRefField
Autosorting type.
void finalizeDateGroupingImport(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField, sal_Int32 nBaseFieldIdx)
Finalizes the grouped date field after import.
sal_Int32 mnField
Name of the data field.
const OUString & getDPFieldName() const
Returns the name of the DataPilot field in the fields collection.
Number format for the result.
PivotTableBuffer(const WorkbookHelper &rHelper)
bool mbAverageSubtotal
True = show count all subtotals.
PivotTableFilter & createTableFilter()
Creates and returns a new pivot table filter.
void finalizeImportBasedOnCache(const css::uno::Reference< css::sheet::XDataPilotDescriptor > &rxDPDesc)
RefVector< PivotTable > PivotTableVector
PivotTableField * getTableField(sal_Int32 nFieldIdx)
Returns a pivot table field by its index.
void importPTReference(SequenceInputStream &rStrm)
Imports pivot field reference settings from the PTREFERENCE record.
void SvStream & rStrm
void importPTFilter(SequenceInputStream &rStrm)
Reads the settings of a field filter from the PTFILTER record.
void importPivotField(const AttributeList &rAttribs)
Imports pivot field settings from the pivotField element.
bool mbCountSubtotal
True = show product subtotals.
PageFieldVector maPageFields
Indexes to fields in column dimension.
PTFieldModel maModel
All items of this field.
sal_Int32 mnBaseItem
Base field for 'show data as'.
OUString maDescription
Name of the field filter.
void convertRowField()
Converts dimension and other settings for a row field.
Number of columns in page filter area.
bool mbMinSubtotal
True = show maximum subtotals.
PivotTableField(PivotTable &rPivotTable, sal_Int32 nFieldIndex)
void importPTColFields(SequenceInputStream &rStrm)
Reads the indexes of all fields located in the column dimension from a PTCOLFIELDS record...
RefVector< PivotTableFilter > PivotTableFilterVector
::std::vector< PivotCacheGroupItem > PivotCacheGroupItemVector
bool mbDefaultSubtotal
True = field appears in data area.
PivotTableFilter(const PivotTable &rPivotTable)
sal_Int32 mnType
Index to shared item in pivot cache.