20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_PIVOTCACHEBUFFER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_PIVOTCACHEBUFFER_HXX
23 #include <com/sun/star/util/DateTime.hpp>
28 namespace oox {
class AttributeList; }
29 namespace oox {
class SequenceInputStream; }
32 namespace sheet {
class XDataPilotField; }
195 maOrigName( rItemName ), maGroupName( rItemName ) {}
272 const css::uno::Reference< css::sheet::XDataPilotField >& rxDPField )
const;
275 const css::uno::Reference< css::sheet::XDataPilotField >& rxBaseDPField )
const;
278 const css::uno::Reference< css::sheet::XDataPilotField >& rxBaseDPField,
280 PivotCacheGroupItemVector& orItemNames )
const;
284 sal_Int32 nCol, sal_Int32 nRow )
const;
287 sal_Int32 nCol, sal_Int32 nRow,
292 const WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow )
const;
300 sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nItemIdx )
const;
397 sal_Int32 nColIdx, sal_Int32 nRowIdx,
Helper class to provide access to global workbook data.
void importDiscretePrItem(sal_Int32 nElement, const AttributeList &rAttribs)
Imports an item of the mapping between group items and base items from the passed element...
::std::vector< IdCaptionPair > IdCaptionPairList
void importPCDFGroupItem(sal_Int32 nRecId, SequenceInputStream &rStrm)
Imports one or more group items from the passed record.
const PivotCacheItem * getCacheItem(sal_Int32 nItemIdx) const
Returns the specified item.
FragmentPathMap maFragmentPaths
bool mbBackgroundQuery
True = refreshing cache is enabled in UI.
OUString createParentGroupField(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField, const PivotCacheField &rBaseCacheField, PivotCacheGroupItemVector &orItemNames) const
Creates a new grouped DataPilot field and returns its name.
bool hasSharedItems() const
Returns true, if the field contains a list of shared items.
bool mbServerField
True = field from source data; false = calculated field.
bool mbDummySheet
True = pivot cache is based on supported data source.
void setBiffGroupBy(sal_uInt8 nGroupBy)
Sets the group-by value for BIFF import.
void importSharedItems(const AttributeList &rAttribs)
Imports shared items settings from the sharedItems element.
void importPCDFSharedItems(SequenceInputStream &rStrm)
Imports shared items settings from the PCDFSHAREDITEMS record.
PCFieldModel maFieldModel
Mapping between group and base items.
bool mbEnableRefresh
True = application may optimize memory usage.
double mfRefreshedDate
Name of user who last refreshed the cache.
sal_Int32 mnMissItemsLimit
Number of data records in the cache.
css::util::DateTime maEndDate
Manual or calculated start date for range grouping.
const OUString & getFinalGroupName() const
Returns the finalized group name of this field.
void importPCDefinition(SequenceInputStream &rStrm)
Reads pivot cache global settings from the PCDEFINITION record.
bool mbHasLongText
True = has numeric item(s) with only integers, maybe other types except date.
const OUString & getRecordsRelId() const
Returns the relation identifier of the pivot cache records fragment.
void writeSourceDataCell(const WorksheetHelper &rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem &rItem) const
Writes a source field item value into the passed sheet.
PivotCacheFieldVector maDatabaseFields
All pivot cache fields.
PivotCacheField & createCacheField()
Creates and returns a new pivot cache field.
bool hasDateGrouping() const
Returns true, if the field has inplace date grouping settings.
void importPCDSource(SequenceInputStream &rStrm)
Reads cache source settings from the PCDSOURCE record.
IndexVector maDatabaseIndexes
All cache fields that are based on source data.
bool mbAutoStart
True = items are grouped by date ranges or by item names.
PCFieldModel()
True = contains OLAP member properties.
sal_Int32 mnNumFmtId
Formula of a calculated field.
PCDefinitionModel maDefModel
Database field index for all fields.
bool mbUniqueList
True = ODBC server-based page field.
const PivotCacheItem * getCacheItem(sal_Int32 nItemIdx) const
Returns the shared or group item with the specified index.
bool hasGroupItems() const
Returns true, if the field contains a list of grouping items.
std::vector< PivotCacheItem > maItems
void writeSourceDataCell(const WorksheetHelper &rSheetHelper, sal_Int32 nColIdx, sal_Int32 nRowIdx, const PivotCacheItem &rItem) const
Writes a source field item value into the passed sheet.
const ScRange & getSourceRange() const
Returns the internal cell range the cache is based on.
PCSharedItemsModel maSharedItemsModel
Settings for this cache field.
double mfEndValue
Manual or calculated start value for range grouping.
bool mbDatabaseField
Number of property mappings.
PivotCacheGroupItem(const OUString &rItemName)
OUString maDefName
Sheet name for cell range or sheet-local defined names.
void finalizeExternalSheetSource()
Finalizes the pivot cache if it is based on sheet data of an external spreadsheet document...
void writeSharedItemToSourceDataCell(const WorksheetHelper &rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nItemIdx) const
Tries to write the value of a shared item to the passed sheet position.
PivotCacheItem & createItem()
Creates and returns a new item at the end of the items list.
void getCacheItemNames(::std::vector< OUString > &orItemNames) const
Returns the names of all items.
void registerPivotCacheFragment(sal_Int32 nCacheId, const OUString &rFragmentPath)
Registers a pivot cache definition fragment.
void importItem(sal_Int32 nElement, const AttributeList &rAttribs)
Imports the item from the passed attribute list.
void applyItemCaptions(const IdCaptionPairList &vCaptions)
exports com.sun.star. sheet
void importWorksheetSource(const AttributeList &rAttribs, const ::oox::core::Relations &rRelations)
Reads sheet source settings from the worksheetSource element.
sal_Int32 getCacheDatabaseIndex(sal_Int32 nFieldIdx) const
Returns the source column index of the field with the passed index.
sal_Int32 mnType
Value of the item.
void importGroupItem(sal_Int32 nElement, const AttributeList &rAttribs)
Imports a group item from the passed element.
bool mbSaveData
True = cache needs refresh.
::std::pair< sal_Int32, OUString > IdCaptionPair
static void writeItemToSourceDataCell(const WorksheetHelper &rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem &rItem)
Tries to write the passed value to the passed sheet position.
PivotCache(const WorkbookHelper &rHelper)
bool mbAutoEnd
True = start value for range groups is calculated from source data.
sal_Int32 mnHierarchy
Data type from ODBC data source.
void importPivotCacheDefinition(const AttributeList &rAttribs)
Reads pivot cache global settings from the pivotCacheDefinition element.
PivotCacheItemList(const WorkbookHelper &rHelper)
::std::vector< sal_Int32 > IndexVector
bool mbSupportDrill
True = data source supports subqueries.
bool isDatabaseField() const
Returns true, if the field is based on source data, or false if it is grouped or calculated.
OUString maPropertyName
Caption of the cache field.
PCWorksheetSourceModel maSheetSrcModel
Pivot cache source settings.
void readNumeric(const AttributeList &rAttribs)
Reads the double value from a pivot cache item.
bool hasNumericGrouping() const
Returns true, if the field has inplace numeric grouping settings.
sal_Int32 mnGroupBy
Index of cache field this grouped field is based on.
PivotCacheBuffer(const WorkbookHelper &rHelper)
void finalizeInternalSheetSource()
Finalizes the pivot cache if it is based on internal sheet data.
void importFieldGroup(const AttributeList &rAttribs)
Imports grouping settings from the fieldGroup element.
PCFieldGroupModel()
Finalized group name of this field used in internal pivot table collection.
void importPCRecordItem(SequenceInputStream &rStrm, const WorksheetHelper &rSheetHelper, sal_Int32 nCol, sal_Int32 nRow) const
Reads an item from the PCRECORD record and writes it to the passed sheet.
void updateSourceDataRow(const WorksheetHelper &rSheetHelper, sal_Int32 nRow) const
Checks, if the row index has changed since last call, and initializes the sheet data buffer...
IndexVector maDiscreteItems
All group items of this field.
bool mbUpgradeOnRefresh
True = application queries data asynchronously.
PCWorksheetSourceModel()
Source cell range of the data.
ValueRangeSet maColSpans
Sheet source data if cache type is sheet.
bool mbOptimizeMemory
True = try to refresh cache on load.
PivotCacheItemList maGroupItems
All shared items of this field.
::std::map< sal_Int32, OUString > FragmentPathMap
void writeSourceHeaderCell(const WorksheetHelper &rSheetHelper, sal_Int32 nCol, sal_Int32 nRow) const
Writes the title of the field into the passed sheet at the passed address.
void importRangePr(const AttributeList &rAttribs)
Imports numeric grouping settings from the rangePr element.
void readDouble(SequenceInputStream &rStrm)
Reads the double value from a pivot cache item.
const PivotCacheItemList & getCacheItems() const
Returns shared or group items.
bool mbHasNonDate
True = has (blank|string|bool|error) item(s), maybe other types.
PCSourceModel maSourceModel
Global pivot cache settings.
bool empty() const
Returns true, if this item list is empty.
void convertNumericGrouping(const css::uno::Reference< css::sheet::XDataPilotField > &rxDPField) const
Creates inplace numeric grouping settings.
void importPCDFieldGroup(SequenceInputStream &rStrm)
Imports grouping settings from the PCDFIELDGROUP record.
::std::vector< sal_Int32 > IndexVector
OUString maCaption
Fixed name of the cache field.
double mfInterval
Manual or calculated end value for range grouping.
bool mbHasDate
True = has non-date item(s), maybe date items.
bool mbIsNumeric
True = has [(string|bool|error) and (number|date)] or (number and date).
OUString maTargetUrl
Column spans used by SheetDataBuffer for optimized cell import.
sal_Int32 mnSqlType
Number format for all items.
bool mbRefreshOnLoad
True = cached item values are present.
bool mbMemberPropField
True = list of unique ODBC items exists.
OUString maFormula
OLAP property name.
void importSharedItem(sal_Int32 nElement, const AttributeList &rAttribs)
Imports a shared item from the passed element.
bool mbTupleCache
True = application may upgrade cache version.
void setFinalGroupName(const OUString &rFinalGroupName)
Set the finalized group name of this field.
bool isBasedOnDummySheet() const
Returns true, if the pivot cache is based on a dummy sheet created in finalizeImport.
PivotCacheFieldVector maFields
sal_Int32 mnParentField
Interval for numeric range grouping.
bool mbDateGroup
True = items are grouped by numeric ranges or date ranges.
void importCacheSource(const AttributeList &rAttribs)
Reads cache source settings from the cacheSource element.
void applyItemCaptions(const IdCaptionPairList &vCaptions)
Apply user Captions to imported group data.
void readBool(const AttributeList &rAttribs)
Reads the boolean value from a pivot cache item.
void setStringValue(const OUString &sName)
OUString getName() const
Returns the string representation of the item.
size_t size() const
Returns the size of the item list.
sal_Int32 getType() const
Returns the type of the item.
std::vector< sal_Int32 > maCacheIds
bool hasParentGrouping() const
Returns true, if the field has a parent group field that groups the items of this field...
bool mbIsInteger
True = has numeric item(s), maybe other types except date.
PCSourceModel()
Connection identifier for external data source.
void writeSourceHeaderCells(const WorksheetHelper &rSheetHelper) const
Writes the titles of all source fields into the passed sheet.
bool mbHasMixed
True = has blank item(s), maybe other types.
void readError(const AttributeList &rAttribs)
Reads the error code value from a pivot cache item.
OUString maSheet
Relation identifier for an external document URL.
void importPCDField(SequenceInputStream &rStrm)
Imports pivot cache field settings from the PCDFIELD record.
sal_Int32 mnMappingCount
Hierarchy level this field is part of.
PCDefinitionModel()
True = data source supports drilldown.
Helper struct for mapping original item names from/to group item names.
OUString maRefreshedBy
Relation identifier for cache records fragment.
bool mbHasBlank
True = has (string|bool|error) item(s), maybe other types.
PivotCacheField * getCacheField(sal_Int32 nFieldIdx)
Returns the cache field with the specified index.
PivotCacheItemList maSharedItems
RefVector< PivotCacheField > PivotCacheFieldVector
void importPCDFRangePr(SequenceInputStream &rStrm)
Imports numeric grouping settings from the PCDFRANGEPR record.
void readIndex(const AttributeList &rAttribs)
Reads the index of a shared item.
bool mbHasString
True = has date item(s), maybe other types.
void finalizeImport()
Checks validity of source data and creates a dummy data sheet for external sheet sources.
RefMap< sal_Int32, PivotCache > PivotCacheMap
bool mbInvalid
Limit for discarding unused items.
void prepareSourceDataSheet()
Creates a dummy sheet that will be filled with the pivot cache data.
PCFieldGroupModel maFieldGroupModel
Settings for shared items.
OUString createDateGroupField(const css::uno::Reference< css::sheet::XDataPilotField > &rxBaseDPField) const
Creates inplace date grouping settings or a new date group field.
const css::uno::Any & getValue() const
Returns the value of the item.
double mfStartValue
Manual or calculated end date for range grouping.
bool isValidDataSource() const
Returns true, if the pivot cache is based on a valid data source, so that pivot tables can be created...
OUString getFormattedName(const ScDPSaveDimension &rSaveDim, ScDPObject *pObj, const DateTime &rNullDate) const
Returns the string representation of the item, using the actual formatting.
sal_Int32 getGroupBaseField() const
Returns the index of the base field grouping is based on.
sal_Int32 mnLevel
Hierarchy this field is part of.
void importPCRecord(SequenceInputStream &rStrm, const WorksheetHelper &rSheetHelper, sal_Int32 nRowIdx) const
Reads a PCRECORD record and writes all item values to the passed sheet.
bool mbUnused
Value type (OOXML token identifier).
void readDate(const AttributeList &rAttribs)
Reads the date/time value from a pivot cache item.
OUString msFinalGroupName
True = end value for range groups is calculated from source data.
bool isUnused() const
Returns true if the item is unused.
PCSharedItemsModel()
True = contains strings with >255 characters.
sal_Int32 mnCurrRow
URL of an external source document.
sal_Int32 mnRecords
Date/time of last refresh.
void importCacheField(const AttributeList &rAttribs)
Imports pivot cache field settings from the cacheField element.
bool mbSupportSubquery
True = cache stores OLAP functions.
void importPCDFSharedItem(sal_Int32 nRecId, SequenceInputStream &rStrm)
Imports one or more shared items from the passed record.
PivotCacheField(const WorkbookHelper &rHelper, bool bIsDatabaseField)
void importArray(SequenceInputStream &rStrm)
Imports an array of items from the PCITEM_ARRAY record.
ScRange maRange
Defined name containing a cell range if present.
void importPCDFDiscretePrItem(sal_Int32 nRecId, SequenceInputStream &rStrm)
Imports an item of the mapping between group items and base items from the passed record...
bool mbValidSource
Current row index in dummy sheet.
sal_Int32 getParentGroupField() const
Returns the index of the parent group field that groups the items of this field.
void getCacheItemNames(::std::vector< OUString > &orItemNames) const
Returns the names of all shared or group items.
::std::vector< PivotCacheGroupItem > PivotCacheGroupItemVector
void importPCDSheetSource(SequenceInputStream &rStrm, const ::oox::core::Relations &rRelations)
Reads sheet source settings from the PCDSHEETSOURCE record.
PivotCache * importPivotCacheFragment(sal_Int32 nCacheId)
Imports and stores a pivot cache definition fragment on first call, returns the imported cache on sub...
const OUString & getName() const
Returns the name of the cache field.
sal_Int32 mnConnectionId
Type of the source data (sheet, consolidation, scenario, external).
sal_Int32 mnBaseField
Index of cache field that contains item groups based on this field.
PivotCache & createPivotCache(sal_Int32 nCacheId)
Creates and returns a new pivot cache object with the passed identifier.
bool mbRangeGroup
Type of numeric or date range grouping.
void readString(const AttributeList &rAttribs)
Reads the string value from a pivot cache item.
css::util::DateTime maStartDate