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>
35 using ::com::sun::star::sheet::DataPilotFieldOrientation;
37 namespace ScDPSortMode = ::com::sun::star::sheet::DataPilotFieldSortMode;
38 namespace ScDPShowItemsMode = ::com::sun::star::sheet::DataPilotFieldShowItemsMode;
39 namespace ScDPLayoutMode = ::com::sun::star::sheet::DataPilotFieldLayoutMode;
40 namespace ScDPRefItemType = ::com::sun::star::sheet::DataPilotFieldReferenceItemType;
41 namespace ScDPGroupBy = ::com::sun::star::sheet::DataPilotFieldGroupBy;
84 maText = OUString::number(nValue);
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" );
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 )
405 rCachedName.
maName.clear();
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;
641 if (nNameLen != 0xFF)
658 if (aFinalName.getLength() >= 254)
659 aFinalName = aFinalName.copy(0, 254);
667 rStrm << sal_uInt16(0xFFFF);
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;
895 << aXclTableName.
Len() << aXclDataName.
Len();
906 mnSxformulaRecs( 0 ),
1026 mbCompactMode(false)
1035 if(sxc == 0x00 && sxd == 0x19)
const sal_uInt16 EXC_SXDI_REF_RUN_TOTAL
sal_uInt16 mnRefItem
Index to SXVD of referred field used for the results.
void SetApiLayoutMode(sal_Int32 nLayoutMode)
Sets the layout mode represented by the passed API constant.
const sal_uInt32 EXC_SXVDEX_SORT
This class stores an unformatted or formatted string for Excel export.
bool IsStdGroupField() const
Returns true, if this field is a grouping field.
XclPTInfo()
Index to pivot table autoformat.
const sal_uInt16 EXC_SXVDEX_FORMAT_NONE
const sal_uInt16 EXC_SXFIELD_16BIT
sal_uInt16 mnRefType
Data aggregation function.
sal_uInt16 mnFlags
Type of the item (e.g. data, function, grand total).
function is determined automatically.
A name for various pivot table info structs.
const sal_uInt16 EXC_SXDI_FUNC_STDDEVP
XclPTFieldInfo()
Index into cache for field name (not part of record).
bool IsGroupField() const
Returns true, if this field is a grouping field of any type.
XclPCInfo()
Name of user who last modified the cache.
void SetApiAggFunc(ScGeneralFunction eAggFunc)
Sets the aggregation function represented by the passed API enum.
const double * GetDouble() const
Returns pointer to value, if the item type is 'double', otherwise 0.
const OUString * GetVisName() const
Returns the name, if set explicitly (maVisName.mbUseCache is false).
Pivot table autoformat settings (SXVIEWEX9 record).
const sal_uInt16 EXC_PT_AUTOFMT_ZERO
void SetScDateType(sal_Int32 nScType)
const sal_uInt16 EXC_SXNUMGROUP_TYPE_QUART
const sal_uInt16 EXC_SXDI_FUNC_STDDEV
const sal_uInt16 EXC_SXVIEW_DEFAULTFLAGS
std::optional< OUString > mpFieldTotalName
const sal_uInt16 EXC_SXNUMGROUP_TYPE_MIN
This class is used to export Excel record streams.
sal_uInt16 mnSrcType
Number of all fields (standard, grouped, calculated).
SC_DLLPUBLIC const std::optional< OUString > & GetGrandTotalName() const
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 ...
XclPCFieldType
Specifies the type of a pivot cache field.
void WriteBuffer(XclExpStream &rStrm) const
Writes the raw character buffer.
void SetError(sal_uInt16 nError)
Sets the item to 'error' type and adds the passed Excel error code.
std::unique_ptr< ContentProperties > pData
bool mbUseCache
The visible name, if used.
sal_uInt16 mnAggFunc
Base field for this data info.
sal_uInt16 mnRefField
Result reference type.
const sal_uInt16 EXC_SXPI_ALLITEMS
Extended information about a pivot table (SXEX record).
const sal_uInt16 EXC_SXDI_PREVITEM
sal_Int32 GetApiLayoutMode() const
Returns the API constant representing the layout mode.
const sal_uInt16 EXC_SXNUMGROUP_TYPE_YEAR
void SetDateTime(const DateTime &rDateTime, const OUString &rText=OUString())
Sets the item to 'date/time' type and adds the passed date.
Contains data for a pivot cache field (SXFIELD record).
sal_uInt8 mnAutoFormat
2 for report* fmts ?
const sal_uInt32 EXC_SXVDEX_LAYOUT_TOP
const bool * GetBool() const
Returns pointer to Boolean value, if the item type is 'boolean', otherwise 0.
sal_Int16 mnValue
Value of a floating-point item.
const sal_uInt16 EXC_SXVI_DEFAULTFLAGS
sal_uInt16 mnColFields
Number of row fields.
void SetApiRefItemType(sal_Int32 nRefItemType)
Sets the result reference item type represented by the passed API constant.
sal_uInt16 mnCacheIdx
Several flags.
sal_uInt16 mnGroupItems
Number of visible items for this field.
void SetText(const OUString &rText)
Sets the item to 'text' type and adds the passed text.
void GetSubtotals(XclPTSubtotalVec &rSubtotals) const
Returns a vector of all set subtotal functions.
const sal_uInt16 EXC_SXVD_AXIS_COL
DateTime maDateTime
Text representation of the item.
XclAddress maDataXclPos
Output range.
numerical values are counted.
const sal_uInt16 EXC_PT_NOSTRING
Standard field without grouping.
const sal_uInt16 EXC_SXVDEX_SHOW_NONE
void SetSubtotals(const XclPTSubtotalVec &rSubtotals)
Sets the subtotal functions contained in the passed sequence.
sum of all numerical values is calculated.
sal_uInt16 mnGroupChild
Various flags.
const sal_uInt16 EXC_SXDI_REF_PERC_TOTAL
const sal_uInt16 EXC_SXDI_REF_PERC_DIFF
void SetBool(bool bValue, const OUString &rText=OUString())
Sets the item to 'boolean' type and adds the passed Boolean value.
void Init(const ScDPObject &rDPObj)
void SetApiSortMode(sal_Int32 nSortMode)
Sets the sorting mode represented by the passed API constant.
sal_uInt16 mnFlags
Number of columns containing data.
sal_uInt16 mnVisItems
Base field if this field contains grouping info.
const sal_uInt16 EXC_SXVI_TYPE_DATA
product of all numerical values is calculated.
sal_Int32 GetApiSortMode() const
Returns the API constant representing the sorting mode.
const sal_uInt16 EXC_SXVD_SUBT_COUNTNUM
const sal_uInt16 EXC_SXVD_SUBT_STDDEV
const sal_uInt16 EXC_SXVD_SUBT_DEFAULT
XclPTDataFieldInfo()
Number format of the results.
ScGeneralFunction GetApiAggFunc() const
Returns the API enum representing the aggregation function.
sal_uInt16 mnFields
Position of data fields.
Special state, not used in Excel files.
const sal_uInt16 EXC_SXDI_FUNC_MIN
const sal_uInt16 EXC_SXDI_FUNC_VAR
Contains data for a numeric grouping field (SXNUMGROUP record).
sal_uInt16 mnSubtCount
Flags for axes this field is part of.
const sal_uInt32 EXC_PT_AUTOFMT_FLAGS
const sal_uInt16 EXC_SXDB_DEFAULTFLAGS
sal_uInt16 mnStdFields
Records in a source database block.
Contains extended data for a pivot table field (SXVDEX record).
sal_uInt16 mnDataRows
Number of data fields.
const sal_uInt16 EXC_SXVD_AXIS_DATA
void AddApiOrient(css::sheet::DataPilotFieldOrientation eOrient)
Adds the axis orientation represented by the passed API enum.
sal_uInt16 mnDataFields
Number of page fields.
const sal_uInt16 EXC_SXNUMGROUP_TYPE_HOUR
Import: Keep old formats when reading unformatted string (default: clear formats); Export: Write unfo...
const sal_uInt16 EXC_SXNUMGROUP_TYPE_DAY
const sal_uInt32 EXC_SXVDEX_LAYOUT_REPORT
const sal_uInt16 EXC_SXNUMGROUP_AUTOMAX
sal_uInt16 mnCacheIdx
First heading row.
variance is calculated based on the entire population.
sal_uInt16 mnShowField
Index to data field sorting bases on.
sal_Int32 GetScDateType() const
sal_uInt16 mnGroupBase
Field containing grouping info for this field.
OUString maGrandTotalName
0 == gridlayout, 0x10 == modern
const sal_uInt16 EXC_SXVD_SUBT_NONE
Contains data for a pivot table page field (part of SXPI record).
void SetInteger(sal_Int16 nValue)
Sets the item to 'integer' type and adds the passed value.
sal_uInt16 mnNumFmt
Index to SXVI of referred item of the used field.
First date grouping field (opt. with child grouping field).
const sal_uInt16 EXC_SXDI_NEXTITEM
XclPTCachedName maVisName
::std::vector< ScGeneralFunction > XclPTSubtotalVec
const sal_uInt16 EXC_SXNUMGROUP_TYPE_NUM
const sal_uInt16 EXC_SXVD_SUBT_MIN
const DateTime * GetDateTime() const
Returns pointer to date, if the item type is 'date/time', otherwise 0.
sal_uInt16 mnStrmId
Records in source database.
const sal_uInt16 EXC_SXDI_REF_INDEX
const OUString * GetText() const
Returns pointer to text, if the item type is 'text', otherwise 0.
sal_uInt16 mnPagePerRow
Number of SXSELECT records.
maximum value of all numerical values is calculated.
bool GetHeaderLayout() const
Contains data for a pivot table field (SXVD record).
const sal_uInt16 EXC_SXVD_SUBT_SUM
void SetXclDataType(sal_uInt16 nXclType)
const sal_uInt16 EXC_SXVIEW_DATALAST
const sal_uInt16 EXC_SXDI_FUNC_COUNTNUM
const sal_uInt32 EXC_SXEX_DEFAULTFLAGS
const sal_uInt16 EXC_SXDI_REF_NORMAL
sal_uInt16 mnOrigItems
Number of items in the base field.
standard deviation is calculated based on the entire population.
const sal_uInt16 EXC_SXFIELD_HASCHILD
sal_uInt16 mnFlags
Stream identifier.
void SetApiAutoShowCount(sal_Int32 nShowCount)
Sets the number of items to be shown in AutoShow mode.
const sal_uInt16 EXC_SXVDEX_SORT_OWN
bool HasVisName() const
The displayed name of the item.
const sal_uInt16 EXC_SXDI_FUNC_COUNT
Additional date grouping field.
sal_uInt16 mnBlockRecs
Flags for the cache.
average of all numerical values is calculated.
bool IsEmpty() const
Returns true, if the item type is 'empty'.
const sal_uInt16 EXC_SXNUMGROUP_AUTOMIN
sal_uInt16 GetXclDataType() const
const sal_uInt16 EXC_SXDI_FUNC_MAX
sal_uInt16 mnSubtotals
Number of subtotal functions.
sal_uInt16 mnDataCols
Number of rows containing data.
const sal_uInt16 EXC_SXNUMGROUP_TYPE_MONTH
XclPCField(XclPCFieldType eFieldType, sal_uInt16 nFieldIdx)
const sal_uInt16 EXC_SXVD_SUBT_VAR
sal_uInt16 mnSelItem
Base field for this page info.
XclExpStream & operator<<(XclExpStream &rStrm, const XclPCFieldInfo &rInfo)
sal_uInt16 mnRowFields
Number of all fields.
sal_uInt16 mnPageFields
Number of column fields.
Contains data for a pivot table data item (SXVI record).
sal_uInt16 mnSortField
Several flags and number of items for AutoShow.
ScDPSaveData * GetSaveData() const
void SetEmpty()
Sets the item to 'empty' type.
const sal_uInt16 EXC_SXVD_SUBT_AVERAGE
const sal_Int16 * GetInteger() const
Returns pointer to integer, if the item type is 'integer', otherwise 0.
sal_uInt16 mnDataPos
Orientation of data fields.
const sal_uInt16 EXC_SXDI_REF_PERC_ROW
const sal_uInt16 EXC_SXDI_FUNC_PRODUCT
sal_Int32 GetApiRefItemType() const
Returns the API constant representing the result reference item type.
Contains data for a pivot table data field (SXDI record).
XclPCItemType
Data type of a pivot cache item.
XclPTPageFieldInfo()
Escher object ID of dropdown listbox.
const sal_uInt32 EXC_SXVDEX_AUTOSHOW_ASC
XclPCItemType GetType() const
Returns the type of the item.
bool IsGroupChildField() const
Returns true, if this field is a child field in a grouping (it has a base field). ...
const sal_uInt16 EXC_SXDI_FUNC_AVERAGE
XclPCNumGroupInfo()
Various flags.
const sal_uInt16 EXC_SXVD_AXIS_PAGE
XclPTExtInfo()
Flags for the entire pivot table.
XclRange maOutXclRange
The visible name of the data field.
bool IsStandardField() const
Returns true, if this is a standard field build directly from source data.
const sal_uInt16 EXC_SXVD_DEFAULT_CACHE
bool Has16BitIndexes() const
Returns true, if the item indexes in the SXINDEXLIST record are stored as 16-bit values.
sal_uInt16 mnTotalFields
Number of standard pivot cache fields.
bool IsGroupBaseField() const
Returns true, if this field has a child field in a grouping.
XclPCFieldInfo maFieldInfo
sal_uInt16 mnPagePerCol
Number of page fields per row.
std::size_t GetRecLeft()
Returns remaining data size of the whole record without record headers.
OUString ReadUniString(sal_uInt16 nChars, sal_uInt8 nFlags)
Reads ext.
const sal_uInt16 EXC_SXVD_SUBT_STDDEVP
OUString maDataName
The name of the pivot table.
const sal_uInt16 EXC_SXDI_FUNC_SUM
const sal_uInt32 EXC_SXVDEX_DEFAULTFLAGS
sal_uInt16 Len() const
Returns the character count of the string.
const sal_uInt16 EXC_SXDI_REF_DIFF
sal_uInt16 mnSxformulaRecs
Contains data for a pivot cache (SXDB record).
const sal_uInt16 * GetError() const
Returns pointer to error code, if the item type is 'error', otherwise 0.
void Ignore(std::size_t nBytes)
Seeks forward inside the current record.
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2, which causes some type-safety issues.
#define SAL_INFO(area, stream)
const sal_uInt16 EXC_SXVD_SUBT_MAX
const sal_uInt16 EXC_SXFIELD_POSTPONE
variance is calculated based on a sample.
sal_Int32 GetApiRefType() const
Returns the API constant representing the result reference type.
all values, including non-numerical values, are counted.
Contains data for a pivot table (SXVIEW record).
sal_uInt16 mnFlags
Name of the pivot cache field.
const sal_uInt16 EXC_PT_MAXSTRLEN
Additional pivot table settings (SXADDL record).
OUString maText
Type of the item.
const sal_uInt16 EXC_SXVI_DEFAULT_CACHE
sal_uInt16 mnObjId
Index to selected item.
XclImpStream & operator>>(XclImpStream &rStrm, XclPCFieldInfo &rInfo)
css::sheet::DataPilotFieldOrientation GetApiOrient(sal_uInt16 nMask) const
Returns the API enum representing the orientation (first of row/col/page/data).
sal_uInt16 mnError
Value of an integer item.
sal_uInt16 mnSxselectRecs
Number of SXFORMULA records.
void SetApiRefType(sal_Int32 nRefType)
Sets the result reference type represented by the passed API constant.
minimum value of all numerical values is calculated.
standard deviation is calculated based on a sample.
void SetVisName(const OUString &rName)
Sets the visible name and enables usage of cache if name is empty.
bool HasPostponedItems() const
Returns true, if the items are stored separately after the last field.
bool IsDateGroupField() const
Returns true, if this field is a date/time grouping field.
const sal_uInt16 EXC_SXVD_AXIS_NONE
void SetApiAutoShowMode(sal_Int32 nShowMode)
Sets the AutoShow mode represented by the passed API constant.
bool HasOrigItems() const
Returns true, if the field is based on a column in the source data area.
#define SAL_WARN(area, stream)
sal_Int32 GetApiAutoShowCount() const
Returns the number of items to be shown in AutoShow mode.
bool HasInlineItems() const
Returns true, if any items are stored after the SXFIELD record.
XclPCFieldInfo()
Number of original source data items.
bool mbValue
Error code of an error item.
const sal_uInt16 EXC_SXVD_AXIS_ROW
const sal_uInt16 EXC_SXDB_SRC_SHEET
bool IsNumGroupField() const
Returns true, if this field is a numeric grouping field.
const sal_uInt16 EXC_SXVIEW_AUTOFMT
const sal_uInt16 EXC_SXVD_SUBT_VARP
const sal_uInt16 EXC_SXDI_REF_PERC_COL
bool IsEqual(const XclPCItem &rItem) const
Returns true, if the passed term equals this item.
const sal_uInt16 EXC_SXNUMGROUP_TYPE_SEC
This class is used to import record oriented streams.
void SetDouble(double fValue, const OUString &rText=OUString())
Sets the item to 'double' type and adds the passed value.
sal_uInt16 mnBaseItems
Number of special items in a grouping field.
XclPTItemInfo()
Index into cache for item name.
XclPCFieldType meFieldType
Pivot cache field info (SXFIELD record).
bool IsSupportedField() const
Returns true, if the type of the field is supported by Calc.
const sal_uInt16 EXC_SXVD_SUBT_PROD
void WriteFlagField(XclExpStream &rStrm) const
Writes the string flags field (1 byte).
sal_uInt32 mnFlags
Number of page fields per column.
const sal_uInt16 EXC_SXDI_REF_PERC
const sal_uInt16 EXC_PT_AUTOFMT_HEADER
const sal_uInt16 EXC_SXDB_BLOCKRECS
const sal_uInt16 EXC_SXDI_FUNC_VARP
OUString maUserName
Database type.
sal_uInt16 mnItemCount
Bitfield for subtotal functions.
sal_uInt16 mnFirstHeadRow
First cell containing data.
const sal_uInt16 EXC_SXVD_SUBT_COUNT
void WriteZeroBytes(std::size_t nBytes)
Writes a sequence of nBytes zero bytes (respects slice setting).
sal_Int32 GetApiAutoShowMode() const
Returns the API constant representing the AutoShow mode.
sal_uInt16 mnAutoFmtIdx
Flags for the entire pivot table.
sal_uInt8 mnGridLayout
AutoFormat ID.
Represents a data item of any type in a pivot cache.
sal_uInt16 mnDataAxis
0-based index of the pivot cache.
sal_uInt16 mnNumFmt
Index to data field AutoShow bases on.