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 -*- */
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"
25namespace com::sun::star {
26 namespace sheet { class XDataPilotDescriptor; }
27 namespace sheet { class XDataPilotField; }
30class ScDPObject;
32namespace oox::xls {
34class PivotTable;
38 sal_Int32 mnCacheItem;
39 sal_Int32 mnType;
40 OUString msCaption;
42 bool mbHidden;
44 explicit PTFieldItemModel();
47 void setBiffType( sal_uInt16 nType );
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;
72 bool mbShowAll;
73 bool mbOutline;
81 explicit PTFieldModel();
84 void setBiffAxis( sal_uInt8 nAxisFlags );
89 OUString maName;
90 sal_Int32 mnField;
91 sal_Int32 mnItem;
93 explicit PTPageFieldModel();
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 );
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 );
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 );
168 css::uno::Reference< css::sheet::XDataPilotField >
169 convertRowColPageField( sal_Int32 nAxis );
172 typedef ::std::vector< PTFieldItemModel > ItemModelVector;
177 OUString maDPFieldName;
178 sal_Int32 mnFieldIndex;
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;
197 explicit PTFilterModel();
203 explicit PivotTableFilter( const PivotTable& rPivotTable );
206 void importFilter( const AttributeList& rAttribs );
208 void importTop10( const AttributeList& rAttribs );
216 void finalizeImport();
225 OUString maName;
232 OUString maPageStyle;
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();
273 sal_Int32 mnFirstDataRow;
274 sal_Int32 mnFirstDataCol;
275 sal_Int32 mnRowPageCount;
276 sal_Int32 mnColPageCount;
278 explicit PTLocationModel();
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 );
319 void finalizeImport();
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;
355 typedef ::std::vector< sal_Int32 > IndexVector;
356 typedef ::std::vector< PTPageFieldModel > PageFieldVector;
357 typedef ::std::vector< PTDataFieldModel > DataFieldVector;
361 PivotTableField* getTableField( sal_Int32 nFieldIdx );
364 static void importField( IndexVector& orFields, const AttributeList& rAttribs );
366 static void importFields( IndexVector& orFields, SequenceInputStream& rStrm );
380 css::uno::Reference< css::sheet::XDataPilotDescriptor >
382 std::map<OUString, css::uno::Any> maInteropGrabBag;
389 explicit PivotTableBuffer( const WorkbookHelper& rHelper );
395 void finalizeImport();
402} // namespace oox::xls
404/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PivotTableBuffer(const WorkbookHelper &rHelper)
RefVector< PivotTable > PivotTableVector
PivotTable & createPivotTable()
Creates and returns a new pivot table.
void finalizeImport()
Inserts all pivot tables into the sheet.
void importPTReference(SequenceInputStream &rStrm)
Imports pivot field reference settings from the PTREFERENCE record.
sal_Int32 mnFieldIndex
Name of the field in DataPilot field collection.
void convertHiddenField()
Converts dimension and other settings for a hidden field.
void convertRowField()
Converts dimension and other settings for a row field.
void convertColField()
Converts dimension and other settings for a column field.
void finalizeImport(const css::uno::Reference< css::sheet::XDataPilotDescriptor > &rxDPDesc)
Finalizes the field after import, creates grouping and other settings.
void importPivotField(const AttributeList &rAttribs)
Imports pivot field settings from the pivotField element.
void convertPageField(const PTPageFieldModel &rPageField)
Converts dimension and other settings for a page field.
void finalizeDateGroupingImport(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField, sal_Int32 nBaseFieldIdx)
Finalizes the grouped date field after import.
void importReference(const AttributeList &rAttribs)
Imports pivot field reference settings from the reference element.
void importReferenceItem(const AttributeList &rAttribs)
Imports pivot field item reference settings from the x element.
void importPTFItem(SequenceInputStream &rStrm)
Imports settings of an item in this pivot field from the PTFITEM record.
void finalizeImportBasedOnCache(const css::uno::Reference< css::sheet::XDataPilotDescriptor > &rxDPDesc)
void finalizeParentGroupingImport(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField, const PivotCacheField &rBaseCacheField, PivotCacheGroupItemVector &orItemNames)
Finalizes the grouped field after import.
OUString maDPFieldName
Pivot field settings.
void importItem(const AttributeList &rAttribs)
Imports settings of an item in this pivot field from the item element.
PivotTableField(PivotTable &rPivotTable, sal_Int32 nFieldIndex)
css::uno::Reference< css::sheet::XDataPilotField > convertRowColPageField(sal_Int32 nAxis)
Converts dimension and other settings for row, column, page, or hidden fields.
ItemModelVector maItems
The parent pivot table object.
const OUString & getDPFieldName() const
Returns the name of the DataPilot field in the fields collection.
void importPTReferenceItem(SequenceInputStream &rStrm)
Imports pivot field item reference settings from the PTREFERENCEITEM record.
::std::vector< PTFieldItemModel > ItemModelVector
void convertDataField(const PTDataFieldModel &rDataField)
Converts dimension and other settings for a data field.
void importPTField(SequenceInputStream &rStrm)
Imports pivot field settings from the PTFIELD record.
PTFieldModel maModel
All items of this field.
PivotTableFilter(const PivotTable &rPivotTable)
void importFilter(const AttributeList &rAttribs)
Reads the settings of a field filter from the filter element.
void finalizeImport()
Applies the filter to the associated pivot table field if possible.
void importTop10Filter(SequenceInputStream &rStrm)
Reads additional settings of a field filter from the TOP10FILTER record.
void importPTFilter(SequenceInputStream &rStrm)
Reads the settings of a field filter from the PTFILTER record.
const PivotTable & mrPivotTable
void importTop10(const AttributeList &rAttribs)
Reads additional settings of a field filter from the top10 element.
void importPTDataField(SequenceInputStream &rStrm)
Reads the settings of a field located in the data dimension from the PTDATAFIELD record.
void finalizeImport()
Inserts the pivot table into the sheet.
void importDataField(const AttributeList &rAttribs)
Reads the settings of a field located in the data dimension from the dataField element.
PTLocationModel maLocationModel
Global pivot table settings.
css::uno::Reference< css::sheet::XDataPilotField > getDataLayoutField() const
Returns the data layout field used to store all data fields in row/col dimension.
IndexVector maColFields
Indexes to fields in row dimension.
css::uno::Reference< css::sheet::XDataPilotField > getDataPilotField(const OUString &rFieldName) const
Returns the associated data pilot field for the specified pivot table field.
PivotTableField & createTableField()
Creates and returns a new pivot table field.
void importPivotTableDefinition(const AttributeList &rAttribs)
Reads global pivot table settings from the pivotTableDefinition element.
void importLocation(const AttributeList &rAttribs, sal_Int16 nSheet)
Reads the location of the pivot table from the location element.
::std::vector< sal_Int32 > IndexVector
static void importField(IndexVector &orFields, const AttributeList &rAttribs)
Reads a field index for the row or column dimension.
sal_Int32 getCacheDatabaseIndex(sal_Int32 nFieldIdx) const
Returns the source column index of the pivot field with the passed index, or -1.
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.
PivotTableFilterVector maFilters
Settings for all fields in data area.
PivotTableFieldVector maFields
static void importFields(IndexVector &orFields, SequenceInputStream &rStrm)
Reads an array of field indexes for the row or column dimension.
DataFieldVector maDataFields
Settings for all fields in page dimension.
ScDPObject * getDPObject()
PivotTable(const WorkbookHelper &rHelper)
void putToInteropGrabBag(const OUString &sName, const AttributeList &rAttribs)
Puts the attributes to the named grab bag value.
void importPTLocation(SequenceInputStream &rStrm, sal_Int16 nSheet)
Reads the location of the pivot table from the PTLOCATION record.
RefVector< PivotTableField > PivotTableFieldVector
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 importColField(const AttributeList &rAttribs)
Reads the index of a field located in the column dimension.
PivotCacheField * getCacheField(sal_Int32 nFieldIdx)
Returns the cache field with the specified index.
::std::vector< PTPageFieldModel > PageFieldVector
PTDefinitionModel maDefModel
All field filters.
RefVector< PivotTableFilter > PivotTableFilterVector
const PivotCacheField * getCacheFieldOfDataField(sal_Int32 nDataItemIdx) const
Returns the base cache field of the data field item with the specified index.
void importPTPageField(SequenceInputStream &rStrm)
Reads the settings of a field located in the page dimension from the PTPAGEFIELD record.
::std::vector< PTDataFieldModel > DataFieldVector
css::uno::Reference< css::sheet::XDataPilotDescriptor > mxDPDescriptor
The pivot cache this table is based on.
PivotCache * mpPivotCache
Location settings of the pivot table.
void importRowField(const AttributeList &rAttribs)
Reads the index of a field located in the row dimension.
PivotTableFilter & createTableFilter()
Creates and returns a new pivot table filter.
void importPTRowFields(SequenceInputStream &rStrm)
Reads the indexes of all fields located in the row dimension from a PTROWFIELDS record.
void importPageField(const AttributeList &rAttribs)
Reads the settings of a field located in the page dimension from the pageField element.
IndexVector maRowFields
Data layout field.
std::map< OUString, css::uno::Any > maInteropGrabBag
Descriptor of the DataPilot object.
void importPTColFields(SequenceInputStream &rStrm)
Reads the indexes of all fields located in the column dimension from a PTCOLFIELDS record.
PivotTableField * getTableField(sal_Int32 nFieldIdx)
Returns a pivot table field by its index.
void importPTDefinition(SequenceInputStream &rStrm)
Reads global pivot table settings from the PTDEFINITION record.
void finalizeFieldsImport()
Finalizes all fields, finds field names and creates grouping fields.
PageFieldVector maPageFields
Indexes to fields in column dimension.
PivotTableField maDataField
All pivot table fields.
Helper class to provide access to global workbook data.
const char * sName
void SvStream & rStrm
::std::vector< PivotCacheGroupItem > PivotCacheGroupItemVector
Definition: qproform.cxx:398
sal_Int32 mnShowDataAs
Subtotal aggregation function.
sal_Int32 mnBaseField
Show data as, based on another field.
sal_Int32 mnSubtotal
Base pivot field.
void setBiffSubtotal(sal_Int32 nSubtotal)
Sets the subtotal aggregation function for BIFF import.
sal_Int32 mnBaseItem
Base field for 'show data as'.
void setBiffShowDataAs(sal_Int32 nShowDataAs)
Sets the 'show data as' type for BIFF import.
sal_Int32 mnField
Name of the data field.
sal_Int32 mnNumFmtId
Base item for 'show data as'.
Number format for the result.
bool mbShowDetails
User caption of the item.
sal_Int32 mnType
Index to shared item in pivot cache.
True = item is hidden.
OUString msCaption
Type of the item.
void setBiffType(sal_uInt16 nType)
Sets item type for BIFF import.
bool mbHidden
True = show item details (items of child fields).
bool mbVarSubtotal
True = show standard deviation of population subtotals.
bool mbCountASubtotal
True = show sum subtotals.
bool mbAutoShow
True = insert page breaks after items.
bool mbStdDevSubtotal
True = show count numbers subtotals.
bool mbVarPSubtotal
True = show variance subtotals.
bool mbProductSubtotal
True = show minimum subtotals.
bool mbTopAutoShow
True = auto show (top 10) filter enabled.
bool mbSumSubtotal
True = show default subtotals.
sal_Int32 mnSortRefField
Autosorting type.
void setBiffAxis(sal_uInt8 nAxisFlags)
Sets axis type for BIFF import.
sal_Int32 mnSortType
Index of the data field auto show filter is based on.
bool mbDataField
Item in reference field for autosorting.
sal_Int32 mnAutoShowRankBy
Number of items (or percent/sum) to be shown in auto show filter.
bool mbInsertPageBreak
True = insert blank rows after items.
bool mbStdDevPSubtotal
True = show standard deviation subtotals.
sal_Int32 mnNumFmtId
Axis this field is assigned to (none, row, column, page).
sal_Int32 mnSortRefItem
Reference field for autosorting.
bool mbSubtotalTop
True = show in outline view, false = show in tabular view.
bool mbCountSubtotal
True = show product subtotals.
bool mbMultiPageItems
True = auto show filter shows top entries, false = bottom.
bool mbDefaultSubtotal
True = field appears in data area.
bool mbOutline
True = show items without data.
sal_Int32 mnAutoShowItems
Number format for field items.
True = multiple items selectable in page dimension.
bool mbInsertBlankRow
True = show subtotals on top of items in outline or compact mode.
bool mbAverageSubtotal
True = show count all subtotals.
bool mbShowAll
True = show variance of population subtotals.
bool mbMinSubtotal
True = show maximum subtotals.
bool mbMaxSubtotal
True = show average subtotals.
double mfValue
Second string value for label filter.
sal_Int32 mnMeasureHier
Data field for filter calculation.
sal_Int32 mnMemPropField
Base pivot field.
bool mbTopFilter
Hierarchy for filter calculation.
sal_Int32 mnEvalOrder
Filter type.
sal_Int32 mnId
Evaluation order index.
sal_Int32 mnType
Member property field.
True = filter shows top entries, false = bottom.
OUString maStrValue2
First string value for label filter.
OUString maStrValue1
Description of the field filter.
sal_Int32 mnField
Number of items or percent or sum to be shown.
sal_Int32 mnMeasureField
Unique identifier.
OUString maDescription
Name of the field filter.
sal_Int32 mnRowPageCount
First column of data cells (relative in pivot table).
sal_Int32 mnFirstDataCol
First row of data cells (relative in pivot table).
sal_Int32 mnFirstHeaderRow
Target cell range for the pivot table.
sal_Int32 mnFirstDataRow
First row of header cells (relative in pivot table).
sal_Int32 mnColPageCount
Number of rows in page filter area.
Number of columns in page filter area.
sal_Int32 mnItem
Base pivot field.
Index of field item that is shown by the page field.
sal_Int32 mnField
Unique name of the page field.
unsigned char sal_uInt8