17#include <document.hxx>
19#include <unonames.hxx>
26#include <oox/token/namespaces.hxx>
32#include <com/sun/star/beans/XPropertySet.hpp>
33#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
34#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
35#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
36#include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
37#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
52 pRecStrm->startElement(XML_pivotCacheRecords,
53 XML_xmlns,
rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
54 FSNS(XML_xmlns, XML_r),
rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
55 XML_count, OString::number(
static_cast<tools::Long>(nCount)));
59 pRecStrm->startElement(XML_r);
60 for (
size_t nField = 0; nField < nFieldCount; ++nField)
68 pRecStrm->singleElement(XML_x, XML_v, OString::number((*pArray)[i]));
70 pRecStrm->endElement(XML_r);
73 pRecStrm->endElement(XML_pivotCacheRecords);
76const char* toOOXMLAxisType( sheet::DataPilotFieldOrientation eOrient )
80 case sheet::DataPilotFieldOrientation_COLUMN:
82 case sheet::DataPilotFieldOrientation_ROW:
84 case sheet::DataPilotFieldOrientation_PAGE:
86 case sheet::DataPilotFieldOrientation_DATA:
88 case sheet::DataPilotFieldOrientation_HIDDEN:
136 pWorkbookStrm->startElement(XML_pivotCaches);
142 sal_Int32 nCacheId =
i + 1;
147 rStrm.GetCurrentStream()->getOutputStream(),
152 pWorkbookStrm->singleElement(XML_pivotCache,
153 XML_cacheId, OString::number(nCacheId),
154 FSNS(XML_r, XML_id), aRelId.toUtf8());
156 rStrm.PushStream(pPCStrm);
161 pWorkbookStrm->endElement(XML_pivotCaches);
180 size_t nPos = nCacheId - 1;
196OUString GetExcelFormattedDate(
double fSerialDateTime,
const SvNumberFormatter& rFormatter )
199 constexpr double fHalfSecond = 1 / 86400.0 * 0.5;
200 css::util::DateTime aUDateTime
203 aUDateTime.NanoSeconds = 0;
206 return sBuf.makeStringAndClear();
221 std::vector<ItemData> aDataToSort;
224 for (sal_Int32
id : aGIIds)
230 aDataToSort.push_back({ aGroupVal.mnValue, pGIData });
233 std::sort(aDataToSort.begin(), aDataToSort.end(),
234 [](
const ItemData& a,
const ItemData& b) { return a.nVal < b.nVal; });
236 std::vector<OUString> aSortedResult;
237 for (
const auto& el : aDataToSort)
241 return aSortedResult;
256 pDefStrm->getOutputStream(),
261 rStrm.PushStream(pRecStrm);
262 savePivotCacheRecordsXml(
rStrm, rCache);
265 pDefStrm->startElement(XML_pivotCacheDefinition,
266 XML_xmlns,
rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
267 FSNS(XML_xmlns, XML_r),
rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
268 FSNS(XML_r, XML_id), aRelId.toUtf8(),
270 XML_createdVersion,
"3");
272 pDefStrm->startElement(XML_cacheSource,
XML_type,
"worksheet");
276 pDefStrm->singleElement(XML_worksheetSource,
278 XML_sheet, aSheetName.toUtf8());
280 pDefStrm->endElement(XML_cacheSource);
284 pDefStrm->startElement(XML_cacheFields,
285 XML_count, OString::number(
static_cast<tools::Long>(
nCount + nGroupFieldCount)));
287 auto WriteFieldGroup = [
this, &rCache, pDefStrm](
size_t i,
size_t base) {
294 case sheet::DataPilotFieldGroupBy::SECONDS:
295 sGroupBy =
"seconds";
297 case sheet::DataPilotFieldGroupBy::MINUTES:
298 sGroupBy =
"minutes";
300 case sheet::DataPilotFieldGroupBy::HOURS:
303 case sheet::DataPilotFieldGroupBy::DAYS:
306 case sheet::DataPilotFieldGroupBy::MONTHS:
309 case sheet::DataPilotFieldGroupBy::QUARTERS:
310 sGroupBy =
"quarters";
312 case sheet::DataPilotFieldGroupBy::YEARS:
318 pDefStrm->startElement(XML_fieldGroup, XML_base, OString::number(
base));
325 pGroupAttList->add(XML_groupBy, sGroupBy);
327 pGroupAttList->add(XML_startDate, GetExcelFormattedDate(pGI->
mfStart, rFormatter).toUtf8());
328 pGroupAttList->add(XML_endDate, GetExcelFormattedDate(pGI->
mfEnd, rFormatter).toUtf8());
330 pGroupAttList->add(XML_groupInterval, OString::number(pGI->
mfStep));
331 pDefStrm->singleElement(XML_rangePr, pGroupAttList);
334 auto aElemVec = SortGroupItems(rCache,
i);
335 pDefStrm->startElement(XML_groupItems, XML_count, OString::number(aElemVec.size()));
336 for (
const auto& sElem : aElemVec)
338 pDefStrm->singleElement(XML_s, XML_v, sElem.toUtf8());
340 pDefStrm->endElement(XML_groupItems);
341 pDefStrm->endElement(XML_fieldGroup);
348 pDefStrm->startElement(XML_cacheField,
349 XML_name,
aName.toUtf8(),
350 XML_numFmtId, OString::number(0));
354 std::set<ScDPItemData::Type> aDPTypes;
355 double fMin = std::numeric_limits<double>::infinity(), fMax = -std::numeric_limits<double>::infinity();
356 bool isValueInteger =
true;
358 bool isLongText =
false;
359 for (
const auto& rFieldItem : rFieldItems)
365 aDPTypes.insert(
eType);
368 double fVal = rFieldItem.GetValue();
369 fMin = std::min(fMin, fVal);
370 fMax = std::max(fMax, fVal);
375 isValueInteger =
false;
380 isLongText = rFieldItem.GetString().getLength() > 255;
389 std::set<ScDPItemData::Type> aDPTypesWithoutBlank = aDPTypes;
394 const bool isContainsNumber
396 bool isContainsNonDate = !(isContainsDate && aDPTypesWithoutBlank.size() <= 1);
402 if (!(isContainsString || (aDPTypes.size() > 1) || (isContainsBlank && aDPTypesWithoutBlank.empty())))
403 pAttList->add(XML_containsSemiMixedTypes, ToPsz10(
false));
405 if (!isContainsNonDate)
406 pAttList->add(XML_containsNonDate, ToPsz10(
false));
409 pAttList->add(XML_containsDate, ToPsz10(
true));
412 if (!isContainsString)
413 pAttList->add(XML_containsString, ToPsz10(
false));
416 pAttList->add(XML_containsBlank, ToPsz10(
true));
421 if (aDPTypesWithoutBlank.size() > 1)
422 pAttList->add(XML_containsMixedTypes, ToPsz10(
true));
429 if (isContainsNumber)
430 pAttList->add(XML_containsNumber, ToPsz10(
true));
432 if (isValueInteger && isContainsNumber)
433 pAttList->add(XML_containsInteger, ToPsz10(
true));
441 if (isContainsNumber)
443 pAttList->add(XML_minValue, OString::number(fMin));
444 pAttList->add(XML_maxValue, OString::number(fMax));
449 pAttList->add(XML_minDate, GetExcelFormattedDate(fMin,
GetFormatter()).toUtf8());
450 pAttList->add(XML_maxDate, GetExcelFormattedDate(fMax,
GetFormatter()).toUtf8());
455 pAttList->add(XML_count, OString::number(
static_cast<tools::Long>(rFieldItems.size())));
460 pAttList->add(XML_longText, ToPsz10(
true));
463 pDefStrm->startElement(XML_sharedItems, pAttList);
469 switch (rItem.GetType())
472 pDefStrm->singleElement(XML_s, XML_v, rItem.GetString().toUtf8());
477 pDefStrm->singleElement(XML_d,
478 XML_v, GetExcelFormattedDate(rItem.GetValue(),
GetFormatter()).toUtf8());
481 pDefStrm->singleElement(XML_n,
482 XML_v, OString::number(rItem.GetValue()));
485 pDefStrm->singleElement(XML_m);
488 pDefStrm->singleElement(XML_e,
489 XML_v, rItem.GetString().toUtf8());
494 pDefStrm->singleElement(XML_m);
502 pDefStrm->endElement(XML_sharedItems);
504 WriteFieldGroup(
i,
i);
506 pDefStrm->endElement(XML_cacheField);
512 for (
size_t i =
nCount; pDPObject &&
i <
nCount + nGroupFieldCount; ++
i)
534 pDefStrm->startElement(XML_cacheField, XML_name,
aName.toUtf8(), XML_numFmtId,
535 OString::number(0), XML_databaseField, ToPsz10(
false));
536 WriteFieldGroup(
i, nBase);
537 pDefStrm->endElement(XML_cacheField);
540 pDefStrm->endElement(XML_cacheFields);
542 pDefStrm->endElement(XML_pivotCacheDefinition);
569 std::vector<XclExpXmlPivotCaches::Entry> aCaches;
571 const std::vector<ScRange>& rRanges = rSheetCaches.
getAllRanges();
572 for (
const auto & rRange : rRanges)
581 for (
const auto& rRef : rRefs)
587 aCaches.push_back(aEntry);
597 CacheIdMapType::iterator itCache =
maCacheIdMap.find(&rDPObj);
602 sal_Int32 nCacheId = itCache->second;
605 TablesType::iterator it =
m_Tables.find(nTab);
609 std::pair<TablesType::iterator, bool> r =
615 p->AppendTable(&rDPObj, nCacheId,
i+1);
628 TablesType::iterator
const it =
m_Tables.find(nTab);
629 return it ==
m_Tables.end() ? nullptr : it->second.get();
633 mpTable(pTable), mnCacheId(nCacheId), mnPivotId(nPivotId) {}
645 sal_Int32 nCacheId = rTable.mnCacheId;
646 sal_Int32 nPivotId = rTable.mnPivotId;
651 pWSStrm->getOutputStream(),
655 rStrm.PushStream(pPivotStrm);
709 return XML_defaultSubtotal;
713void WriteGrabBagItemToStream(
XclExpXmlStream& rStrm, sal_Int32 tokenId,
const css::uno::Any& rItem)
715 css::uno::Sequence<css::uno::Any> aSeqs;
716 if(!(rItem >>= aSeqs))
719 auto& pStrm =
rStrm.GetCurrentStream();
720 pStrm->write(
"<")->writeId(tokenId);
722 css::uno::Sequence<css::xml::FastAttribute> aFastSeq;
723 css::uno::Sequence<css::xml::Attribute> aUnkSeq;
724 for (
const auto& a : std::as_const(aSeqs))
728 for (
const auto& rAttr : std::as_const(aFastSeq))
729 rStrm.WriteAttributes(rAttr.Token, rAttr.Value);
731 else if (a >>= aUnkSeq)
733 for (
const auto& rAttr : std::as_const(aUnkSeq))
737 ->writeEscaped(rAttr.Value)
748 typedef std::unordered_map<OUString, long> NameToIdMapType;
760 std::vector<const ScDPSaveDimension*> aCachedDims;
761 NameToIdMapType aNameToIdMap;
763 aCachedDims.reserve(nFieldCount);
764 for (
size_t i = 0;
i < nFieldCount; ++
i)
767 aNameToIdMap.emplace(
aName, aCachedDims.size());
769 aCachedDims.push_back(pDim);
772 std::vector<tools::Long> aRowFields;
773 std::vector<tools::Long> aColFields;
774 std::vector<tools::Long> aPageFields;
775 std::vector<DataField> aDataFields;
782 bool bTabularMode =
false;
783 bool bCompactMode =
true;
784 for (
const auto &
i : rDims)
794 NameToIdMapType::iterator it = aNameToIdMap.find(aSrcName);
795 if (it != aNameToIdMap.end())
801 if (!aCachedDims[
nPos])
809 case sheet::DataPilotFieldOrientation_COLUMN:
810 if (
nPos == -2 && nDataDimCount <= 1)
812 aColFields.push_back(
nPos);
814 case sheet::DataPilotFieldOrientation_ROW:
815 aRowFields.push_back(
nPos);
817 case sheet::DataPilotFieldOrientation_PAGE:
818 aPageFields.push_back(
nPos);
820 case sheet::DataPilotFieldOrientation_DATA:
821 aDataFields.emplace_back(
nPos, &rDim);
823 case sheet::DataPilotFieldOrientation_HIDDEN:
830 bTabularMode |= (eLayoutMode == sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT);
831 bCompactMode &= (eLayoutMode == sheet::DataPilotFieldLayoutMode::COMPACT_LAYOUT);
836 pPivotStrm->startElement(XML_pivotTableDefinition,
837 XML_xmlns,
rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
838 XML_name, rDPObj.
GetName().toUtf8(),
839 XML_cacheId, OString::number(nCacheId),
840 XML_applyNumberFormats, ToPsz10(
false),
841 XML_applyBorderFormats, ToPsz10(
false),
842 XML_applyFontFormats, ToPsz10(
false),
843 XML_applyPatternFormats, ToPsz10(
false),
844 XML_applyAlignmentFormats, ToPsz10(
false),
845 XML_applyWidthHeightFormats, ToPsz10(
false),
846 XML_dataCaption,
"Values",
848 XML_useAutoFormatting, ToPsz10(
false),
849 XML_itemPrintTitles, ToPsz10(
true),
850 XML_indent, ToPsz10(
false),
851 XML_outline, ToPsz10(!bTabularMode),
852 XML_outlineData, ToPsz10(!bTabularMode),
853 XML_compact, ToPsz10(bCompactMode),
854 XML_compactData, ToPsz10(bCompactMode));
860 sal_Int32 nFirstDataRow = 2;
861 sal_Int32 nFirstDataCol = 1;
873 pPivotStrm->write(
"<")->writeId(XML_location);
874 rStrm.WriteAttributes(XML_ref,
876 XML_firstHeaderRow, OUString::number(nFirstHeaderRow),
877 XML_firstDataRow, OUString::number(nFirstDataRow),
878 XML_firstDataCol, OUString::number(nFirstDataCol));
880 if (!aPageFields.empty())
882 rStrm.WriteAttributes(XML_rowPageCount, OUString::number(
static_cast<tools::Long>(aPageFields.size())));
883 rStrm.WriteAttributes(XML_colPageCount, OUString::number(1));
886 pPivotStrm->write(
"/>");
892 pPivotStrm->startElement(XML_pivotFields,
893 XML_count, OString::number(
static_cast<tools::Long>(aCachedDims.size())));
895 for (
size_t i = 0;
i < nFieldCount; ++
i)
900 pPivotStrm->singleElement(XML_pivotField,
901 XML_compact, ToPsz10(
false),
902 XML_showAll, ToPsz10(
false));
906 bool bDimInTabularMode =
false;
907 bool bDimInCompactMode =
false;
911 bDimInTabularMode = (eLayoutMode == sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT);
912 bDimInCompactMode = (eLayoutMode == sheet::DataPilotFieldLayoutMode::COMPACT_LAYOUT);
915 sheet::DataPilotFieldOrientation eOrient = pDim->
GetOrientation();
917 if (eOrient == sheet::DataPilotFieldOrientation_HIDDEN)
919 if(bDimInTabularMode)
921 pPivotStrm->singleElement(XML_pivotField,
922 XML_compact, ToPsz10(
false),
923 XML_showAll, ToPsz10(
false),
924 XML_outline, ToPsz10(
false));
928 if (bDimInCompactMode)
929 pPivotStrm->singleElement(XML_pivotField,
930 XML_showAll, ToPsz10(
false));
932 pPivotStrm->singleElement(XML_pivotField,
933 XML_compact, ToPsz10(
false),
934 XML_showAll, ToPsz10(
false));
939 if (eOrient == sheet::DataPilotFieldOrientation_DATA)
941 if(bDimInTabularMode)
943 pPivotStrm->singleElement(XML_pivotField,
944 XML_dataField, ToPsz10(
true),
945 XML_compact, ToPsz10(
false),
946 XML_showAll, ToPsz10(
false),
947 XML_outline, ToPsz10(
false));
951 if (bDimInCompactMode)
952 pPivotStrm->singleElement(XML_pivotField,
953 XML_dataField, ToPsz10(
true),
954 XML_showAll, ToPsz10(
false));
956 pPivotStrm->singleElement(XML_pivotField,
957 XML_dataField, ToPsz10(
true),
958 XML_compact, ToPsz10(
false),
959 XML_showAll, ToPsz10(
false));
965 std::vector<ScDPLabelData::Member> aMembers;
972 std::vector<OUString> aCacheFieldItems;
977 OUString sFormattedName;
978 if (it.HasStringData() || it.IsEmpty())
979 sFormattedName = it.GetString();
981 sFormattedName =
const_cast<ScDPObject&
>(rDPObj).GetFormattedString(
982 pDim->
GetName(), it.GetValue());
983 aCacheFieldItems.push_back(sFormattedName);
988 aCacheFieldItems = SortGroupItems(rCache,
i);
991 std::vector< std::pair<size_t, bool> > aMemberSequence;
992 std::set<size_t> aUsedCachePositions;
993 for (
const auto & rMember : aMembers)
995 auto it = std::find(aCacheFieldItems.begin(), aCacheFieldItems.end(), rMember.maName);
996 if (it != aCacheFieldItems.end())
998 size_t nCachePos =
static_cast<size_t>(std::distance(aCacheFieldItems.begin(), it));
999 auto aInserted = aUsedCachePositions.insert(nCachePos);
1000 if (aInserted.second)
1001 aMemberSequence.emplace_back(std::make_pair(nCachePos, !rMember.mbVisible));
1005 for (
size_t nItem = 0; nItem < aCacheFieldItems.size(); ++nItem)
1007 if (aUsedCachePositions.find(nItem) == aUsedCachePositions.end())
1008 aMemberSequence.emplace_back(nItem,
true);
1012 bool bAppearsInData =
false;
1015 const auto it = std::find_if(
1016 aDataFields.begin(), aDataFields.end(), [&aSrcName](
const DataField& rDataField) {
1018 = ScDPUtil::getSourceDimensionName(rDataField.mpDim->GetName());
1019 return aThisName == aSrcName;
1021 if (it != aDataFields.end())
1022 bAppearsInData =
true;
1026 pAttList->add(XML_axis, toOOXMLAxisType(eOrient));
1028 pAttList->add(XML_dataField, ToPsz10(
true));
1030 if (!bDimInCompactMode)
1031 pAttList->add(XML_compact, ToPsz10(
false));
1033 pAttList->add(XML_showAll, ToPsz10(
false));
1036 std::vector<OString> aSubtotalSequence;
1037 bool bHasDefaultSubtotal =
false;
1038 for (
tools::Long nSubTotal = 0; nSubTotal < nSubTotalCount; ++nSubTotal)
1041 aSubtotalSequence.push_back(GetSubtotalFuncName(eFunc));
1042 sal_Int32 nAttToken = GetSubtotalAttrToken(eFunc);
1043 if (nAttToken == XML_defaultSubtotal)
1044 bHasDefaultSubtotal =
true;
1045 else if (!pAttList->hasAttribute(nAttToken))
1046 pAttList->add(nAttToken, ToPsz10(
true));
1049 if (!bHasDefaultSubtotal)
1050 pAttList->add(XML_defaultSubtotal, ToPsz10(
false));
1052 if(bDimInTabularMode)
1053 pAttList->add( XML_outline, ToPsz10(
false));
1054 pPivotStrm->startElement(XML_pivotField, pAttList);
1056 pPivotStrm->startElement(XML_items,
1057 XML_count, OString::number(
static_cast<tools::Long>(aMemberSequence.size() + aSubtotalSequence.size())));
1059 for (
const auto & nMember : aMemberSequence)
1063 pItemAttList->add(XML_h, ToPsz10(
true));
1064 pItemAttList->add(XML_x, OString::number(
static_cast<tools::Long>(nMember.first)));
1065 pPivotStrm->singleElement(XML_item, pItemAttList);
1068 for (
const OString& sSubtotal : aSubtotalSequence)
1070 pPivotStrm->singleElement(XML_item, XML_t, sSubtotal);
1073 pPivotStrm->endElement(XML_items);
1074 pPivotStrm->endElement(XML_pivotField);
1077 pPivotStrm->endElement(XML_pivotFields);
1081 if (!aRowFields.empty())
1083 pPivotStrm->startElement(XML_rowFields,
1084 XML_count, OString::number(
static_cast<tools::Long>(aRowFields.size())));
1086 for (
const auto& rRowField : aRowFields)
1088 pPivotStrm->singleElement(XML_field, XML_x, OString::number(rRowField));
1091 pPivotStrm->endElement(XML_rowFields);
1098 if (!aColFields.empty())
1100 pPivotStrm->startElement(XML_colFields,
1101 XML_count, OString::number(
static_cast<tools::Long>(aColFields.size())));
1103 for (
const auto& rColField : aColFields)
1105 pPivotStrm->singleElement(XML_field, XML_x, OString::number(rColField));
1108 pPivotStrm->endElement(XML_colFields);
1115 if (!aPageFields.empty())
1117 pPivotStrm->startElement(XML_pageFields,
1118 XML_count, OString::number(
static_cast<tools::Long>(aPageFields.size())));
1120 for (
const auto& rPageField : aPageFields)
1122 pPivotStrm->singleElement(XML_pageField,
1123 XML_fld, OString::number(rPageField),
1124 XML_hier, OString::number(-1));
1127 pPivotStrm->endElement(XML_pageFields);
1132 if (!aDataFields.empty())
1134 css::uno::Reference<css::container::XNameAccess> xDimsByName;
1135 if (
auto xDimSupplier =
const_cast<ScDPObject&
>(rDPObj).GetSource())
1136 xDimsByName = xDimSupplier->getDimensions();
1138 pPivotStrm->startElement(XML_dataFields,
1139 XML_count, OString::number(
static_cast<tools::Long>(aDataFields.size())));
1141 for (
const auto& rDataField : aDataFields)
1144 assert(nDimIdx == -2 || aCachedDims[nDimIdx]);
1155 pItemAttList->add(XML_name,
pName->toUtf8());
1156 pItemAttList->add(XML_fld, OString::number(nDimIdx));
1157 const char* pSubtotal = toOOXMLSubtotalType(rDim.
GetFunction());
1159 pItemAttList->add(XML_subtotal, pSubtotal);
1164 css::uno::Reference<css::beans::XPropertySet> xDimProps(
1165 xDimsByName->getByName(rDim.
GetName()), uno::UNO_QUERY_THROW);
1167 sal_uInt32 nScNumFmt = aVal.get<sal_uInt32>();
1169 pItemAttList->add(XML_numFmtId, OString::number(nXclNumFmt));
1171 catch (uno::Exception&)
1174 "Couldn't get number format for data field " << rDim.
GetName());
1178 pPivotStrm->singleElement(XML_dataField, pItemAttList);
1181 pPivotStrm->endElement(XML_dataFields);
1186 WriteGrabBagItemToStream(
rStrm, XML_pivotTableStyleInfo, aVal);
1188 pPivotStrm->singleElement(XML_pivotTableStyleInfo, XML_name,
"PivotStyleLight16",
1189 XML_showRowHeaders,
"1", XML_showColHeaders,
"1",
1190 XML_showRowStripes,
"0", XML_showColStripes,
"0",
1191 XML_showLastColumn,
"1");
1193 OUString
aBuf =
"../pivotCache/pivotCacheDefinition" +
1194 OUString::number(nCacheId) +
1198 pPivotStrm->getOutputStream(),
1202 pPivotStrm->endElement(XML_pivotTableDefinition);
1207 maTables.emplace_back(pTable, nCacheId, nPivotId);
This class represents the cached data part of the datapilot cache table implementation.
sal_Int32 GetGroupType(tools::Long nDim) const
Return a group type identifier.
SCROW GetDataSize() const
Data size is the number of records without any trailing empty rows for sheet source data.
const ScDPItemData * GetItemDataById(tools::Long nDim, SCROW nId) const
bool IsDateDimension(tools::Long nDim) const
std::vector< SCROW > IndexArrayType
void GetGroupDimMemberIds(tools::Long nDim, std::vector< SCROW > &rIds) const
OUString GetFormattedString(tools::Long nDim, const ScDPItemData &rItem, bool bLocaleIndependent) const
const ScDPNumGroupInfo * GetNumGroupInfo(tools::Long nDim) const
const ScDPObjectSet & GetAllReferences() const
size_t GetGroupFieldCount() const
size_t GetFieldCount() const
OUString GetDimensionName(std::vector< OUString >::size_type nDim) const
const ScDPItemDataVec & GetDimMemberValues(SCCOL nDim) const
std::vector< ScDPItemData > ScDPItemDataVec
const IndexArrayType * GetFieldIndexArray(size_t nDim) const
SCCOL GetDimensionIndex(std::u16string_view sName) const
Stores and manages all caches from internal sheets.
SC_DLLPUBLIC const std::vector< ScRange > & getAllRanges() const
SC_DLLPUBLIC ScDPCache * getExistingCache(const ScRange &rRange)
SC_DLLPUBLIC SheetCaches & GetSheetCaches()
SC_DLLPUBLIC size_t GetCount() const
const ScDPSaveGroupDimension * GetNamedGroupDim(const OUString &rGroupDimName) const
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
GroupValueAttr GetGroupValue() const
const ScRange & GetOutRange() const
bool SyncAllDimensionMembers()
Remove in the save data entries for members that don't exist anymore.
bool GetHeaderLayout() const
std::pair< bool, css::uno::Any > GetInteropGrabBagValue(const OUString &sName) const
bool GetMembers(sal_Int32 nDim, sal_Int32 nHier, ::std::vector< ScDPLabelData::Member > &rMembers)
ScRange GetOutputRangeByType(sal_Int32 nType)
ScDPSaveData * GetSaveData() const
const OUString & GetName() const
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
bool GetExpandCollapse() const
std::vector< std::unique_ptr< ScDPSaveDimension > > DimsType
const DimsType & GetDimensions() const
SC_DLLPUBLIC ScDPDimensionSaveData * GetDimensionData()
SC_DLLPUBLIC tools::Long GetDataDimensionCount() const
ScGeneralFunction GetSubTotalFunc(tools::Long nIndex) const
css::sheet::DataPilotFieldOrientation GetOrientation() const
const css::sheet::DataPilotFieldLayoutInfo * GetLayoutInfo() const
const std::optional< OUString > & GetLayoutName() const
ScGeneralFunction GetFunction() const
tools::Long GetSubTotalsCount() const
bool IsDataLayout() const
const OUString & GetName() const
Represents a new group dimension whose dimension ID is higher than the highest source dimension ID.
const OUString & GetSourceDimName() const
static SC_DLLPUBLIC OUString getSourceDimensionName(std::u16string_view rName)
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
static SC_DLLPUBLIC OUString getDisplayedMeasureName(const OUString &rName, ScSubTotalFunc eFunc)
SC_DLLPUBLIC bool HasPivotTable() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
sal_uInt16 Insert(sal_uInt32 nScNumFmt)
Inserts a number format into the format buffer.
Access to global data from other classes.
XclExpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
const Entry * GetCache(sal_Int32 nCacheId) const
void SavePivotCacheXml(XclExpXmlStream &rStrm, const Entry &rEntry, sal_Int32 nCacheId)
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpXmlPivotCaches(const XclExpRoot &rRoot)
void SetCaches(std::vector< Entry > &&rCaches)
std::vector< Entry > maCaches
XclExpXmlPivotCaches & GetCaches()
CacheIdMapType maCacheIdMap
XclExpXmlPivotTables * GetTablesBySheet(SCTAB nTab)
XclExpXmlPivotCaches maCaches
XclExpXmlPivotTableManager(const XclExpRoot &rRoot)
XclExpXmlPivotTables(const XclExpRoot &rRoot, const XclExpXmlPivotCaches &rCaches)
void SavePivotTableXml(XclExpXmlStream &rStrm, const ScDPObject &rObj, sal_Int32 nCacheId)
void AppendTable(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
const XclExpXmlPivotCaches & mrCaches
virtual void SaveXml(XclExpXmlStream &rStrm) override
SvNumberFormatter & GetFormatter() const
Returns the number formatter of the Calc document.
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
static OString ToOString(const Color &rColor)
static OUString GetStreamName(const char *sStreamDir, const char *sStream, sal_Int32 nId)
const_iterator begin() const
static void convertDateTime(OUStringBuffer &rBuffer, const css::util::DateTime &rDateTime, sal_Int16 const *pTimeZoneOffset, bool bAddTimeIf0AM=false)
static rtl::Reference< FastAttributeList > createAttrList()
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
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.
@ STDEV
standard deviation is calculated based on a sample.
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
constexpr T & temporary(T &&x)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
#define CREATE_OFFICEDOC_RELATION_TYPE(ascii)
#define CREATE_XL_CONTENT_TYPE(ascii)
const ScDPCache * mpCache
Entry(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
used as [n] in pivotTable[n].xml part name.
constexpr OUStringLiteral SC_UNONAME_NUMFMT