26#include <osl/diagnose.h>
28#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
29#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
30#include <com/sun/star/sheet/DataPilotFieldShowItemsMode.hpp>
31#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
32#include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
33#include <com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp>
35using ::com::sun::star::sheet::DataPilotFieldOrientation;
37namespace ScDPSortMode = ::com::sun::star::sheet::DataPilotFieldSortMode;
38namespace ScDPShowItemsMode = ::com::sun::star::sheet::DataPilotFieldShowItemsMode;
39namespace ScDPLayoutMode = ::com::sun::star::sheet::DataPilotFieldLayoutMode;
40namespace ScDPRefItemType = ::com::sun::star::sheet::DataPilotFieldReferenceItemType;
41namespace ScDPGroupBy = ::com::sun::star::sheet::DataPilotFieldGroupBy;
95 case 0x00:
maText =
"#nullptr!";
break;
96 case 0x07:
maText =
"#DIV/0!";
break;
97 case 0x0F:
maText =
"#VALUE!";
break;
98 case 0x17:
maText =
"#REF!";
break;
99 case 0x1D:
maText =
"#NAME?";
break;
100 case 0x24:
maText =
"#NUM!";
break;
101 case 0x2A:
maText =
"#N/A";
break;
125 default: OSL_FAIL(
"XclPCItem::IsEqual - unknown pivot cache item type" );
192 if(
rStrm.GetRecLeft() >= 3 )
227 sal_Int32 nScType = 0;
237 default:
SAL_WARN(
"sc.filter",
"XclPCNumGroupInfo::GetScDateType - unexpected date type " <<
GetXclDataType() );
255 SAL_INFO(
"sc.filter",
"unexpected date type " << nScType);
262 return ::extract_value< sal_uInt16 >(
mnFlags, 2, 4 );
284 meFieldType( eFieldType ),
285 mnFieldIdx( nFieldIdx )
402 nStrLen =
rStrm.ReaduInt16();
405 rCachedName.
maName.clear();
407 rCachedName.
maName =
rStrm.ReadUniString( nStrLen );
472 DataPilotFieldOrientation eOrient = DataPilotFieldOrientation_HIDDEN;
473 sal_uInt16 nUsedAxes =
mnAxes & nMask;
475 eOrient = DataPilotFieldOrientation_ROW;
477 eOrient = DataPilotFieldOrientation_COLUMN;
479 eOrient = DataPilotFieldOrientation_PAGE;
481 eOrient = DataPilotFieldOrientation_DATA;
502 rSubtotals.reserve( 16 );
521 for(
const auto& rSubtotal : rSubtotals )
542 for( sal_uInt16 nMask = 0x8000; nMask; nMask >>= 1 )
581 sal_Int32 nSortMode = ScDPSortMode::MANUAL;
589 bool bSort = (nSortMode == ScDPSortMode::NAME) || (nSortMode == ScDPSortMode::DATA);
591 if( nSortMode == ScDPSortMode::NAME )
598 ScDPShowItemsMode::FROM_TOP, ScDPShowItemsMode::FROM_BOTTOM );
608 return ::extract_value< sal_Int32 >(
mnFlags, 24, 8 );
618 sal_Int32 nLayoutMode = ScDPLayoutMode::TABULAR_LAYOUT;
621 ScDPLayoutMode::OUTLINE_SUBTOTALS_TOP : ScDPLayoutMode::OUTLINE_SUBTOTALS_BOTTOM;
638 nNameLen =
rStrm.ReaduInt8();
641 if (nNameLen != 0xFF)
658 if (aFinalName.getLength() >= 254)
659 aFinalName = aFinalName.copy(0, 254);
662 rStrm.WriteZeroBytes(10);
667 rStrm << sal_uInt16(0xFFFF);
668 rStrm.WriteZeroBytes(8);
752 namespace ScDPRefType = ::com::sun::star::sheet::DataPilotFieldReferenceType;
771 namespace ScDPRefType = ::com::sun::star::sheet::DataPilotFieldReferenceType;
788 sal_Int32 nRefItemType;
793 default: nRefItemType = ScDPRefItemType::NAMED;
800 switch( nRefItemType )
836 mnCacheIdx( 0xFFFF ),
853 sal_uInt16 nTabLen, nDataLen;
871 nTabLen =
rStrm.ReaduInt16();
872 nDataLen =
rStrm.ReaduInt16();
895 << aXclTableName.
Len() << aXclDataName.
Len();
906 mnSxformulaRecs( 0 ),
996 const std::optional<OUString> & pGrandTotal =
pData->GetGrandTotalName();
1026 mbCompactMode(false)
1035 if(sxc == 0x00 && sxd == 0x19)
1037 sal_uInt32 nFlags =
rStrm.ReaduInt32();
bool GetHeaderLayout() const
ScDPSaveData * GetSaveData() const
This class is used to export Excel record streams.
This class stores an unformatted or formatted string for Excel export.
void WriteFlagField(XclExpStream &rStrm) const
Writes the string flags field (1 byte).
void WriteBuffer(XclExpStream &rStrm) const
Writes the raw character buffer.
sal_uInt16 Len() const
Returns the character count of the string.
This class is used to import record oriented streams.
bool IsGroupChildField() const
Returns true, if this field is a child field in a grouping (it has a base field).
bool IsDateGroupField() const
Returns true, if this field is a date/time grouping field.
bool Has16BitIndexes() const
Returns true, if the item indexes in the SXINDEXLIST record are stored as 16-bit values.
bool HasInlineItems() const
Returns true, if any items are stored after the SXFIELD record.
bool IsSupportedField() const
Returns true, if the type of the field is supported by Calc.
bool IsGroupBaseField() const
Returns true, if this field has a child field in a grouping.
bool IsNumGroupField() const
Returns true, if this field is a numeric grouping field.
XclPCFieldType meFieldType
Pivot cache field info (SXFIELD record).
bool IsGroupField() const
Returns true, if this field is a grouping field of any type.
bool IsStandardField() const
Returns true, if this is a standard field build directly from source data.
bool HasOrigItems() const
Returns true, if the field is based on a column in the source data area.
bool HasPostponedItems() const
Returns true, if the items are stored separately after the last field.
XclPCFieldInfo maFieldInfo
XclPCField(XclPCFieldType eFieldType, sal_uInt16 nFieldIdx)
bool IsStdGroupField() const
Returns true, if this field is a grouping field.
Represents a data item of any type in a pivot cache.
void SetError(sal_uInt16 nError)
Sets the item to 'error' type and adds the passed Excel error code.
const bool * GetBool() const
Returns pointer to Boolean value, if the item type is 'boolean', otherwise 0.
const sal_uInt16 * GetError() const
Returns pointer to error code, if the item type is 'error', otherwise 0.
const double * GetDouble() const
Returns pointer to value, if the item type is 'double', otherwise 0.
void SetEmpty()
Sets the item to 'empty' type.
void SetBool(bool bValue, const OUString &rText=OUString())
Sets the item to 'boolean' type and adds the passed Boolean value.
DateTime maDateTime
Text representation of the item.
const OUString * GetText() const
Returns pointer to text, if the item type is 'text', otherwise 0.
XclPCItemType GetType() const
Returns the type of the item.
void SetDateTime(const DateTime &rDateTime, const OUString &rText=OUString())
Sets the item to 'date/time' type and adds the passed date.
bool IsEqual(const XclPCItem &rItem) const
Returns true, if the passed term equals this item.
void SetDouble(double fValue, const OUString &rText=OUString())
Sets the item to 'double' type and adds the passed value.
sal_Int16 mnValue
Value of a floating-point item.
bool IsEmpty() const
Returns true, if the item type is 'empty'.
void SetText(const OUString &rText)
Sets the item to 'text' type and adds the passed text.
bool mbValue
Error code of an error item.
void SetInteger(sal_Int16 nValue)
Sets the item to 'integer' type and adds the passed value.
const DateTime * GetDateTime() const
Returns pointer to date, if the item type is 'date/time', otherwise 0.
sal_uInt16 mnError
Value of an integer item.
const sal_Int16 * GetInteger() const
Returns pointer to integer, if the item type is 'integer', otherwise 0.
OUString maText
Type of the item.
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
@ AVERAGE
average of all numerical values is calculated.
@ PRODUCT
product of all numerical values is calculated.
@ MAX
maximum value of all numerical values is calculated.
@ COUNT
all values, including non-numerical values, are counted.
@ VARP
variance is calculated based on the entire population.
@ SUM
sum of all numerical values is calculated.
@ STDEVP
standard deviation is calculated based on the entire population.
@ COUNTNUMS
numerical values are counted.
@ MIN
minimum value of all numerical values is calculated.
@ VAR
variance is calculated based on a sample.
@ AUTO
function is determined automatically.
@ STDEV
standard deviation is calculated based on a sample.
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral EMPTY
Contains data for a pivot cache field (SXFIELD record).
sal_uInt16 mnBaseItems
Number of special items in a grouping field.
sal_uInt16 mnGroupItems
Number of visible items for this field.
sal_uInt16 mnVisItems
Base field if this field contains grouping info.
sal_uInt16 mnGroupChild
Various flags.
sal_uInt16 mnFlags
Name of the pivot cache field.
sal_uInt16 mnOrigItems
Number of items in the base field.
XclPCFieldInfo()
Number of original source data items.
sal_uInt16 mnGroupBase
Field containing grouping info for this field.
Contains data for a pivot cache (SXDB record).
XclPCInfo()
Name of user who last modified the cache.
sal_uInt16 mnSrcType
Number of all fields (standard, grouped, calculated).
sal_uInt16 mnFlags
Stream identifier.
OUString maUserName
Database type.
sal_uInt16 mnTotalFields
Number of standard pivot cache fields.
sal_uInt16 mnStrmId
Records in source database.
sal_uInt16 mnStdFields
Records in a source database block.
sal_uInt16 mnBlockRecs
Flags for the cache.
Contains data for a numeric grouping field (SXNUMGROUP record).
sal_uInt16 GetXclDataType() const
void SetXclDataType(sal_uInt16 nXclType)
XclPCNumGroupInfo()
Various flags.
sal_Int32 GetScDateType() const
void SetScDateType(sal_Int32 nScType)
Additional pivot table settings (SXADDL record).
A name for various pivot table info structs.
bool mbUseCache
The visible name, if used.
Contains data for a pivot table data field (SXDI record).
ScGeneralFunction GetApiAggFunc() const
Returns the API enum representing the aggregation function.
XclPTDataFieldInfo()
Number format of the results.
void SetApiRefItemType(sal_Int32 nRefItemType)
Sets the result reference item type represented by the passed API constant.
sal_uInt16 mnRefItem
Index to SXVD of referred field used for the results.
void SetApiRefType(sal_Int32 nRefType)
Sets the result reference type represented by the passed API constant.
sal_uInt16 mnRefField
Result reference type.
sal_uInt16 mnNumFmt
Index to SXVI of referred item of the used field.
sal_uInt16 mnRefType
Data aggregation function.
sal_Int32 GetApiRefItemType() const
Returns the API constant representing the result reference item type.
sal_Int32 GetApiRefType() const
Returns the API constant representing the result reference type.
void SetApiAggFunc(ScGeneralFunction eAggFunc)
Sets the aggregation function represented by the passed API enum.
sal_uInt16 mnAggFunc
Base field for this data info.
Extended information about a pivot table (SXEX record).
sal_uInt16 mnSxformulaRecs
sal_uInt32 mnFlags
Number of page fields per column.
sal_uInt16 mnPagePerRow
Number of SXSELECT records.
XclPTExtInfo()
Flags for the entire pivot table.
sal_uInt16 mnPagePerCol
Number of page fields per row.
sal_uInt16 mnSxselectRecs
Number of SXFORMULA records.
Contains extended data for a pivot table field (SXVDEX record).
void SetApiAutoShowMode(sal_Int32 nShowMode)
Sets the AutoShow mode represented by the passed API constant.
sal_Int32 GetApiLayoutMode() const
Returns the API constant representing the layout mode.
void SetApiAutoShowCount(sal_Int32 nShowCount)
Sets the number of items to be shown in AutoShow mode.
void SetApiLayoutMode(sal_Int32 nLayoutMode)
Sets the layout mode represented by the passed API constant.
sal_uInt16 mnSortField
Several flags and number of items for AutoShow.
sal_uInt16 mnNumFmt
Index to data field AutoShow bases on.
sal_Int32 GetApiAutoShowCount() const
Returns the number of items to be shown in AutoShow mode.
std::optional< OUString > mpFieldTotalName
sal_Int32 GetApiAutoShowMode() const
Returns the API constant representing the AutoShow mode.
void SetApiSortMode(sal_Int32 nSortMode)
Sets the sorting mode represented by the passed API constant.
sal_uInt16 mnShowField
Index to data field sorting bases on.
sal_Int32 GetApiSortMode() const
Returns the API constant representing the sorting mode.
Contains data for a pivot table field (SXVD record).
sal_uInt16 mnSubtotals
Number of subtotal functions.
sal_uInt16 mnItemCount
Bitfield for subtotal functions.
sal_uInt16 mnSubtCount
Flags for axes this field is part of.
XclPTFieldInfo()
Index into cache for field name (not part of record).
void SetSubtotals(const XclPTSubtotalVec &rSubtotals)
Sets the subtotal functions contained in the passed sequence.
css::sheet::DataPilotFieldOrientation GetApiOrient(sal_uInt16 nMask) const
Returns the API enum representing the orientation (first of row/col/page/data).
void AddApiOrient(css::sheet::DataPilotFieldOrientation eOrient)
Adds the axis orientation represented by the passed API enum.
void GetSubtotals(XclPTSubtotalVec &rSubtotals) const
Returns a vector of all set subtotal functions.
Contains data for a pivot table (SXVIEW record).
OUString maDataName
The name of the pivot table.
XclRange maOutXclRange
The visible name of the data field.
sal_uInt16 mnFlags
Number of columns containing data.
XclPTInfo()
Index to pivot table autoformat.
sal_uInt16 mnDataPos
Orientation of data fields.
sal_uInt16 mnPageFields
Number of column fields.
sal_uInt16 mnDataCols
Number of rows containing data.
sal_uInt16 mnDataRows
Number of data fields.
sal_uInt16 mnCacheIdx
First heading row.
XclAddress maDataXclPos
Output range.
sal_uInt16 mnFields
Position of data fields.
sal_uInt16 mnColFields
Number of row fields.
sal_uInt16 mnDataFields
Number of page fields.
sal_uInt16 mnAutoFmtIdx
Flags for the entire pivot table.
sal_uInt16 mnDataAxis
0-based index of the pivot cache.
sal_uInt16 mnFirstHeadRow
First cell containing data.
sal_uInt16 mnRowFields
Number of all fields.
Contains data for a pivot table data item (SXVI record).
sal_uInt16 mnCacheIdx
Several flags.
XclPTItemInfo()
Index into cache for item name.
sal_uInt16 mnFlags
Type of the item (e.g. data, function, grand total).
Contains data for a pivot table page field (part of SXPI record).
XclPTPageFieldInfo()
Escher object ID of dropdown listbox.
sal_uInt16 mnSelItem
Base field for this page info.
sal_uInt16 mnObjId
Index to selected item.
Pivot table autoformat settings (SXVIEWEX9 record).
void Init(const ScDPObject &rDPObj)
XclPTViewEx9Info()
classic : 10 08 00 00 00 00 00 00 20 00 00 00 01 00 00 00 00 default : 10 08 00 00 00 00 00 00 20 00 ...
sal_uInt8 mnGridLayout
AutoFormat ID.
sal_uInt8 mnAutoFormat
2 for report* fmts ?
OUString maGrandTotalName
0 == gridlayout, 0x10 == modern
XclPTCachedName maVisName
const OUString * GetVisName() const
Returns the name, if set explicitly (maVisName.mbUseCache is false).
void SetVisName(const OUString &rName)
Sets the visible name and enables usage of cache if name is empty.
bool HasVisName() const
The displayed name of the item.
XclExpStream & operator<<(XclExpStream &rStrm, const XclPCFieldInfo &rInfo)
XclImpStream & operator>>(XclImpStream &rStrm, XclPCFieldInfo &rInfo)
const sal_uInt16 EXC_SXDB_DEFAULTFLAGS
const sal_uInt16 EXC_SXFIELD_POSTPONE
const sal_uInt16 EXC_SXDI_FUNC_AVERAGE
const sal_uInt16 EXC_SXDI_REF_INDEX
const sal_uInt16 EXC_SXDI_PREVITEM
const sal_uInt16 EXC_SXDI_FUNC_VAR
const sal_uInt16 EXC_SXVIEW_AUTOFMT
const sal_uInt16 EXC_SXVD_SUBT_COUNT
const sal_uInt32 EXC_SXVDEX_AUTOSHOW_ASC
const sal_uInt16 EXC_SXDI_REF_PERC_TOTAL
const sal_uInt16 EXC_SXNUMGROUP_TYPE_NUM
const sal_uInt16 EXC_PT_NOSTRING
const sal_uInt16 EXC_SXDI_FUNC_COUNT
const sal_uInt16 EXC_SXVD_SUBT_COUNTNUM
const sal_uInt16 EXC_SXDI_FUNC_MIN
const sal_uInt16 EXC_SXDI_FUNC_SUM
XclPCFieldType
Specifies the type of a pivot cache field.
@ EXC_PCFIELD_NUMGROUP
Standard grouping field.
@ EXC_PCFIELD_DATEGROUP
Numeric grouping field.
@ EXC_PCFIELD_STDGROUP
Standard field without grouping.
@ EXC_PCFIELD_UNKNOWN
Calculated field.
@ EXC_PCFIELD_CALCED
Additional date grouping field.
@ EXC_PCFIELD_DATECHILD
First date grouping field (opt. with child grouping field).
const sal_uInt16 EXC_SXDI_NEXTITEM
const sal_uInt16 EXC_SXVD_AXIS_DATA
const sal_uInt16 EXC_SXVDEX_SHOW_NONE
const sal_uInt16 EXC_SXVD_SUBT_MAX
const sal_uInt16 EXC_SXVD_SUBT_DEFAULT
const sal_uInt16 EXC_SXVDEX_FORMAT_NONE
const sal_uInt16 EXC_SXNUMGROUP_TYPE_DAY
const sal_uInt16 EXC_SXVD_SUBT_STDDEVP
const sal_uInt32 EXC_SXVDEX_DEFAULTFLAGS
const sal_uInt16 EXC_SXNUMGROUP_TYPE_MIN
const sal_uInt16 EXC_SXVD_SUBT_VAR
const sal_uInt16 EXC_SXVI_DEFAULT_CACHE
const sal_uInt16 EXC_SXVD_AXIS_COL
XclPCItemType
Data type of a pivot cache item.
@ EXC_PCITEM_TEXT
Empty cell.
@ EXC_PCITEM_INTEGER
Date/time.
@ EXC_PCITEM_DOUBLE
String data.
@ EXC_PCITEM_ERROR
Boolean value.
@ EXC_PCITEM_DATETIME
Floating-point value.
@ EXC_PCITEM_EMPTY
Special state, not used in Excel files.
@ EXC_PCITEM_BOOL
16-bit integer value.
const sal_uInt32 EXC_PT_AUTOFMT_FLAGS
const sal_uInt16 EXC_SXVIEW_DEFAULTFLAGS
const sal_uInt16 EXC_SXVD_AXIS_NONE
const sal_uInt16 EXC_SXFIELD_16BIT
const sal_uInt16 EXC_SXNUMGROUP_AUTOMIN
const sal_uInt16 EXC_SXDI_REF_PERC_COL
const sal_uInt16 EXC_SXDI_REF_PERC_DIFF
const sal_uInt32 EXC_SXVDEX_LAYOUT_TOP
const sal_uInt16 EXC_SXDI_REF_RUN_TOTAL
const sal_uInt16 EXC_PT_AUTOFMT_ZERO
const sal_uInt16 EXC_SXVD_AXIS_ROW
const sal_uInt16 EXC_SXDI_FUNC_VARP
const sal_uInt16 EXC_SXNUMGROUP_TYPE_HOUR
const sal_uInt16 EXC_SXDB_BLOCKRECS
::std::vector< ScGeneralFunction > XclPTSubtotalVec
const sal_uInt16 EXC_SXVD_DEFAULT_CACHE
const sal_uInt16 EXC_SXVD_AXIS_PAGE
const sal_uInt16 EXC_PT_AUTOFMT_HEADER
const sal_uInt16 EXC_SXVD_SUBT_AVERAGE
const sal_uInt16 EXC_SXVD_SUBT_SUM
const sal_uInt16 EXC_SXDI_FUNC_PRODUCT
const sal_uInt16 EXC_SXNUMGROUP_TYPE_QUART
const sal_uInt16 EXC_SXNUMGROUP_TYPE_MONTH
const sal_uInt16 EXC_SXDI_FUNC_MAX
const sal_uInt16 EXC_SXVD_SUBT_MIN
const sal_uInt16 EXC_SXDI_FUNC_STDDEVP
const sal_uInt16 EXC_SXPI_ALLITEMS
const sal_uInt16 EXC_SXVD_SUBT_STDDEV
const sal_uInt16 EXC_SXNUMGROUP_TYPE_SEC
const sal_uInt32 EXC_SXEX_DEFAULTFLAGS
const sal_uInt16 EXC_SXDI_REF_PERC_ROW
const sal_uInt16 EXC_SXVD_SUBT_NONE
const sal_uInt16 EXC_SXDI_REF_NORMAL
const sal_uInt16 EXC_SXVD_SUBT_PROD
const sal_uInt16 EXC_SXDI_REF_PERC
const sal_uInt16 EXC_SXVDEX_SORT_OWN
const sal_uInt16 EXC_SXDB_SRC_SHEET
const sal_uInt16 EXC_SXVI_DEFAULTFLAGS
const sal_uInt16 EXC_SXDI_REF_DIFF
const sal_uInt16 EXC_PT_MAXSTRLEN
const sal_uInt16 EXC_SXVIEW_DATALAST
const sal_uInt16 EXC_SXVI_TYPE_DATA
const sal_uInt32 EXC_SXVDEX_SORT
const sal_uInt16 EXC_SXFIELD_HASCHILD
const sal_uInt16 EXC_SXNUMGROUP_AUTOMAX
const sal_uInt32 EXC_SXVDEX_LAYOUT_REPORT
const sal_uInt16 EXC_SXNUMGROUP_TYPE_YEAR
const sal_uInt16 EXC_SXDI_FUNC_STDDEV
const sal_uInt16 EXC_SXDI_FUNC_COUNTNUM
const sal_uInt16 EXC_SXVD_SUBT_VARP
@ NoHeader
Import: Keep old formats when reading unformatted string (default: clear formats); Export: Write unfo...