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,
55 XML_count, OString::number(static_cast<tools::Long>(nCount)));
57 for (
SCROW i = 0;
i < nCount; ++
i)
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);
76 const 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;
152 pWorkbookStrm->singleElement(XML_pivotCache,
153 XML_cacheId, OString::number(nCacheId),
154 FSNS(XML_r, XML_id), aRelId.toUtf8());
161 pWorkbookStrm->endElement(XML_pivotCaches);
180 size_t nPos = nCacheId - 1;
196 OUString 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(),
262 savePivotCacheRecordsXml(rStrm, rCache);
265 pDefStrm->startElement(XML_pivotCacheDefinition,
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);
344 for (
size_t i = 0; i < nCount; ++i)
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 =
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(),
709 return XML_defaultSubtotal;
713 void WriteGrabBagItemToStream(
XclExpXmlStream& rStrm, sal_Int32 tokenId,
const css::uno::Any& rItem)
715 css::uno::Sequence<css::uno::Any> aSeqs;
716 if(!(rItem >>= aSeqs))
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))
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 for (
const auto &
i : rDims)
793 NameToIdMapType::iterator it = aNameToIdMap.find(aSrcName);
794 if (it != aNameToIdMap.end())
800 if (!aCachedDims[nPos])
808 case sheet::DataPilotFieldOrientation_COLUMN:
809 if (nPos == -2 && nDataDimCount <= 1)
811 aColFields.push_back(nPos);
813 case sheet::DataPilotFieldOrientation_ROW:
814 aRowFields.push_back(nPos);
816 case sheet::DataPilotFieldOrientation_PAGE:
817 aPageFields.push_back(nPos);
819 case sheet::DataPilotFieldOrientation_DATA:
820 aDataFields.emplace_back(nPos, &rDim);
822 case sheet::DataPilotFieldOrientation_HIDDEN:
827 bTabularMode |= (rDim.
GetLayoutInfo()->LayoutMode == sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT);
831 pPivotStrm->startElement(XML_pivotTableDefinition,
833 XML_name, rDPObj.
GetName().toUtf8(),
834 XML_cacheId, OString::number(nCacheId),
835 XML_applyNumberFormats, ToPsz10(
false),
836 XML_applyBorderFormats, ToPsz10(
false),
837 XML_applyFontFormats, ToPsz10(
false),
838 XML_applyPatternFormats, ToPsz10(
false),
839 XML_applyAlignmentFormats, ToPsz10(
false),
840 XML_applyWidthHeightFormats, ToPsz10(
false),
841 XML_dataCaption,
"Values",
842 XML_useAutoFormatting, ToPsz10(
false),
843 XML_itemPrintTitles, ToPsz10(
true),
844 XML_indent, ToPsz10(
false),
845 XML_outline, ToPsz10(!bTabularMode),
846 XML_outlineData, ToPsz10(!bTabularMode),
847 XML_compact, ToPsz10(
false),
848 XML_compactData, ToPsz10(
false));
854 sal_Int32 nFirstDataRow = 2;
855 sal_Int32 nFirstDataCol = 1;
867 pPivotStrm->write(
"<")->writeId(XML_location);
870 XML_firstHeaderRow, OUString::number(nFirstHeaderRow),
871 XML_firstDataRow, OUString::number(nFirstDataRow),
872 XML_firstDataCol, OUString::number(nFirstDataCol));
874 if (!aPageFields.empty())
876 rStrm.
WriteAttributes(XML_rowPageCount, OUString::number(static_cast<tools::Long>(aPageFields.size())));
880 pPivotStrm->write(
"/>");
886 pPivotStrm->startElement(XML_pivotFields,
887 XML_count, OString::number(static_cast<tools::Long>(aCachedDims.size())));
889 for (
size_t i = 0;
i < nFieldCount; ++
i)
894 pPivotStrm->singleElement(XML_pivotField,
895 XML_compact, ToPsz10(
false),
896 XML_showAll, ToPsz10(
false));
900 bool bDimInTabularMode =
false;
902 bDimInTabularMode = (pDim->
GetLayoutInfo()->LayoutMode == sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT);
904 sheet::DataPilotFieldOrientation eOrient = pDim->
GetOrientation();
906 if (eOrient == sheet::DataPilotFieldOrientation_HIDDEN)
908 if(bDimInTabularMode)
910 pPivotStrm->singleElement(XML_pivotField,
911 XML_compact, ToPsz10(
false),
912 XML_showAll, ToPsz10(
false),
913 XML_outline, ToPsz10(
false));
917 pPivotStrm->singleElement(XML_pivotField,
918 XML_compact, ToPsz10(
false),
919 XML_showAll, ToPsz10(
false));
924 if (eOrient == sheet::DataPilotFieldOrientation_DATA)
926 if(bDimInTabularMode)
928 pPivotStrm->singleElement(XML_pivotField,
929 XML_dataField, ToPsz10(
true),
930 XML_compact, ToPsz10(
false),
931 XML_showAll, ToPsz10(
false),
932 XML_outline, ToPsz10(
false));
936 pPivotStrm->singleElement(XML_pivotField,
937 XML_dataField, ToPsz10(
true),
938 XML_compact, ToPsz10(
false),
939 XML_showAll, ToPsz10(
false));
945 std::vector<ScDPLabelData::Member> aMembers;
952 std::vector<OUString> aCacheFieldItems;
957 OUString sFormattedName;
958 if (it.HasStringData() || it.IsEmpty())
959 sFormattedName = it.GetString();
961 sFormattedName =
const_cast<ScDPObject&
>(rDPObj).GetFormattedString(
962 pDim->
GetName(), it.GetValue());
963 aCacheFieldItems.push_back(sFormattedName);
968 aCacheFieldItems = SortGroupItems(rCache,
i);
971 std::vector< std::pair<size_t, bool> > aMemberSequence;
972 std::set<size_t> aUsedCachePositions;
973 for (
const auto & rMember : aMembers)
975 auto it = std::find(aCacheFieldItems.begin(), aCacheFieldItems.end(), rMember.maName);
976 if (it != aCacheFieldItems.end())
978 size_t nCachePos =
static_cast<size_t>(std::distance(aCacheFieldItems.begin(), it));
979 auto aInserted = aUsedCachePositions.insert(nCachePos);
980 if (aInserted.second)
981 aMemberSequence.emplace_back(std::make_pair(nCachePos, !rMember.mbVisible));
985 for (
size_t nItem = 0; nItem < aCacheFieldItems.size(); ++nItem)
987 if (aUsedCachePositions.find(nItem) == aUsedCachePositions.end())
988 aMemberSequence.emplace_back(nItem,
true);
992 bool bAppearsInData =
false;
995 const auto it = std::find_if(
996 aDataFields.begin(), aDataFields.end(), [&aSrcName](
const DataField& rDataField) {
999 return aThisName == aSrcName;
1001 if (it != aDataFields.end())
1002 bAppearsInData =
true;
1006 pAttList->add(XML_axis, toOOXMLAxisType(eOrient));
1008 pAttList->add(XML_dataField, ToPsz10(
true));
1009 pAttList->add(XML_compact, ToPsz10(
false));
1010 pAttList->add(XML_showAll, ToPsz10(
false));
1013 std::vector<OString> aSubtotalSequence;
1014 bool bHasDefaultSubtotal =
false;
1015 for (
tools::Long nSubTotal = 0; nSubTotal < nSubTotalCount; ++nSubTotal)
1018 aSubtotalSequence.push_back(GetSubtotalFuncName(eFunc));
1019 sal_Int32 nAttToken = GetSubtotalAttrToken(eFunc);
1020 if (nAttToken == XML_defaultSubtotal)
1021 bHasDefaultSubtotal =
true;
1022 else if (!pAttList->hasAttribute(nAttToken))
1023 pAttList->add(nAttToken, ToPsz10(
true));
1026 if (!bHasDefaultSubtotal)
1027 pAttList->add(XML_defaultSubtotal, ToPsz10(
false));
1029 if(bDimInTabularMode)
1030 pAttList->add( XML_outline, ToPsz10(
false));
1031 pPivotStrm->startElement(XML_pivotField, pAttList);
1033 pPivotStrm->startElement(XML_items,
1034 XML_count, OString::number(static_cast<tools::Long>(aMemberSequence.size() + aSubtotalSequence.size())));
1036 for (
const auto & nMember : aMemberSequence)
1040 pItemAttList->add(XML_h, ToPsz10(
true));
1041 pItemAttList->add(XML_x, OString::number(static_cast<tools::Long>(nMember.first)));
1042 pPivotStrm->singleElement(XML_item, pItemAttList);
1045 for (
const OString& sSubtotal : aSubtotalSequence)
1047 pPivotStrm->singleElement(XML_item, XML_t, sSubtotal);
1050 pPivotStrm->endElement(XML_items);
1051 pPivotStrm->endElement(XML_pivotField);
1054 pPivotStrm->endElement(XML_pivotFields);
1058 if (!aRowFields.empty())
1060 pPivotStrm->startElement(XML_rowFields,
1061 XML_count, OString::number(static_cast<tools::Long>(aRowFields.size())));
1063 for (
const auto& rRowField : aRowFields)
1065 pPivotStrm->singleElement(XML_field, XML_x, OString::number(rRowField));
1068 pPivotStrm->endElement(XML_rowFields);
1075 if (!aColFields.empty())
1077 pPivotStrm->startElement(XML_colFields,
1078 XML_count, OString::number(static_cast<tools::Long>(aColFields.size())));
1080 for (
const auto& rColField : aColFields)
1082 pPivotStrm->singleElement(XML_field, XML_x, OString::number(rColField));
1085 pPivotStrm->endElement(XML_colFields);
1092 if (!aPageFields.empty())
1094 pPivotStrm->startElement(XML_pageFields,
1095 XML_count, OString::number(static_cast<tools::Long>(aPageFields.size())));
1097 for (
const auto& rPageField : aPageFields)
1099 pPivotStrm->singleElement(XML_pageField,
1100 XML_fld, OString::number(rPageField),
1101 XML_hier, OString::number(-1));
1104 pPivotStrm->endElement(XML_pageFields);
1109 if (!aDataFields.empty())
1111 css::uno::Reference<css::container::XNameAccess> xDimsByName;
1112 if (
auto xDimSupplier = const_cast<ScDPObject&>(rDPObj).GetSource())
1113 xDimsByName = xDimSupplier->getDimensions();
1115 pPivotStrm->startElement(XML_dataFields,
1116 XML_count, OString::number(static_cast<tools::Long>(aDataFields.size())));
1118 for (
const auto& rDataField : aDataFields)
1121 assert(aCachedDims[nDimIdx]);
1132 pItemAttList->add(XML_name, pName->toUtf8());
1133 pItemAttList->add(XML_fld, OString::number(nDimIdx));
1134 const char* pSubtotal = toOOXMLSubtotalType(rDim.
GetFunction());
1136 pItemAttList->add(XML_subtotal, pSubtotal);
1141 css::uno::Reference<css::beans::XPropertySet> xDimProps(
1142 xDimsByName->getByName(rDim.
GetName()), uno::UNO_QUERY_THROW);
1144 sal_uInt32 nScNumFmt = aVal.get<sal_uInt32>();
1146 pItemAttList->add(XML_numFmtId, OString::number(nXclNumFmt));
1148 catch (uno::Exception&)
1151 "Couldn't get number format for data field " << rDim.
GetName());
1155 pPivotStrm->singleElement(XML_dataField, pItemAttList);
1158 pPivotStrm->endElement(XML_dataFields);
1163 WriteGrabBagItemToStream(rStrm, XML_pivotTableStyleInfo, aVal);
1165 pPivotStrm->singleElement(XML_pivotTableStyleInfo, XML_name,
"PivotStyleLight16",
1166 XML_showRowHeaders,
"1", XML_showColHeaders,
"1",
1167 XML_showRowStripes,
"0", XML_showColStripes,
"0",
1168 XML_showLastColumn,
"1");
1170 OUString
aBuf =
"../pivotCache/pivotCacheDefinition" +
1171 OUString::number(nCacheId) +
1175 pPivotStrm->getOutputStream(),
1179 pPivotStrm->endElement(XML_pivotTableDefinition);
1184 maTables.emplace_back(pTable, nCacheId, nPivotId);
void WriteAttributes(sal_Int32 nAttribute, Str &&value, Args &&...rest)
const std::optional< OUString > & GetLayoutName() const
size_t GetGroupFieldCount() const
static OString ToOString(const Color &rColor)
OUString GetFormattedString(tools::Long nDim, const ScDPItemData &rItem, bool bLocaleIndependent) const
const XclExpRoot & GetRoot() const
Returns the filter root data.
SC_DLLPUBLIC size_t GetCount() const
OUString GetDimensionName(std::vector< OUString >::size_type nDim) const
SC_DLLPUBLIC SheetCaches & GetSheetCaches()
size_t GetFieldCount() const
css::sheet::DataPilotFieldOrientation GetOrientation() const
CacheIdMapType maCacheIdMap
XclExpXmlPivotTableManager(const XclExpRoot &rRoot)
std::unique_ptr< sal_Int32[]> pData
ScGeneralFunction GetSubTotalFunc(tools::Long nIndex) const
const css::sheet::DataPilotFieldLayoutInfo * GetLayoutInfo() const
SC_DLLPUBLIC ScDPDimensionSaveData * GetDimensionData()
#define CREATE_OFFICEDOC_RELATION_TYPE(ascii)
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
const OUString & GetSourceDimName() const
numerical values are counted.
const ScDPItemDataVec & GetDimMemberValues(SCCOL nDim) const
sum of all numerical values is calculated.
bool IsDataLayout() const
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
SvNumberFormatter & GetFormatter() const
Returns the number formatter of the Calc document.
This class represents the cached data part of the datapilot cache table implementation.
product of all numerical values is calculated.
SCCOL GetDimensionIndex(std::u16string_view sName) const
Access to global data from other classes.
const ScDPSaveGroupDimension * GetNamedGroupDim(const OUString &rGroupDimName) const
const ScRange & GetOutRange() const
OUString getNamespaceURL(sal_Int32 nNSID) const
const XclExpXmlPivotCaches & mrCaches
sal_Int32 GetGroupType(tools::Long nDim) const
Return a group type identifier.
const ScDPItemData * GetItemDataById(tools::Long nDim, SCROW nId) const
void PushStream(sax_fastparser::FSHelperPtr const &aStream)
void SetCaches(std::vector< Entry > &&rCaches)
void AppendTable(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
bool SyncAllDimensionMembers()
Remove in the save data entries for members that don't exist anymore.
std::vector< Entry > maCaches
variance is calculated based on the entire population.
ScGeneralFunction GetFunction() const
sax_fastparser::FSHelperPtr & GetCurrentStream()
const ScDPNumGroupInfo * GetNumGroupInfo(tools::Long nDim) const
static SC_DLLPUBLIC OUString getSourceDimensionName(std::u16string_view rName)
maximum value of all numerical values is calculated.
void SavePivotCacheXml(XclExpXmlStream &rStrm, const Entry &rEntry, sal_Int32 nCacheId)
bool GetHeaderLayout() const
const Entry * GetCache(sal_Int32 nCacheId) const
standard deviation is calculated based on the entire population.
SC_DLLPUBLIC tools::Long GetDataDimensionCount() const
static rtl::Reference< FastAttributeList > createAttrList()
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
tools::Long GetSubTotalsCount() const
SC_DLLPUBLIC bool HasPivotTable() const
SC_DLLPUBLIC const std::vector< ScRange > & getAllRanges() const
Stores and manages all caches from internal sheets.
average of all numerical values is calculated.
sal_uInt16 Insert(sal_uInt32 nScNumFmt)
Inserts a number format into the format buffer.
sax_fastparser::FSHelperPtr CreateOutputStream(const OUString &sFullStream, std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream > &xParentRelation, const char *sContentType, std::u16string_view sRelationshipType, OUString *pRelationshipId=nullptr)
XclExpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
SCROW GetDataSize() const
Data size is the number of records without any trailing empty rows for sheet source data...
const OUString & GetName() const
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
Entry(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
used as [n] in pivotTable[n].xml part name.
std::vector< ScDPItemData > ScDPItemDataVec
static void convertDateTime(OUStringBuffer &rBuffer, const css::util::DateTime &rDateTime, sal_Int16 const *pTimeZoneOffset, bool bAddTimeIf0AM=false)
GroupValueAttr GetGroupValue() const
ScDPSaveData * GetSaveData() const
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
const ScDPCache * mpCache
XclExpXmlPivotCaches(const XclExpRoot &rRoot)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
XclExpXmlPivotCaches & GetCaches()
bool GetMembers(sal_Int32 nDim, sal_Int32 nHier,::std::vector< ScDPLabelData::Member > &rMembers)
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
constexpr T & temporary(T &&x)
const_iterator begin() const
static OUString GetStreamName(const char *sStreamDir, const char *sStream, sal_Int32 nId)
XclExpXmlPivotTables(const XclExpRoot &rRoot, const XclExpXmlPivotCaches &rCaches)
const IndexArrayType * GetFieldIndexArray(size_t nDim) const
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
const DimsType & GetDimensions() const
#define CREATE_XL_CONTENT_TYPE(ascii)
XclExpXmlPivotCaches maCaches
virtual void SaveXml(XclExpXmlStream &rStrm) override
bool IsDateDimension(tools::Long nDim) const
#define SC_UNONAME_NUMFMT
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2, which causes some type-safety issues.
const OUString & GetName() const
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
std::vector< std::unique_ptr< ScDPSaveDimension > > DimsType
const ScDPObjectSet & GetAllReferences() const
variance is calculated based on a sample.
all values, including non-numerical values, are counted.
Represents a new group dimension whose dimension ID is higher than the highest source dimension ID...
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
void SavePivotTableXml(XclExpXmlStream &rStrm, const ScDPObject &rObj, sal_Int32 nCacheId)
minimum value of all numerical values is calculated.
standard deviation is calculated based on a sample.
std::vector< SCROW > IndexArrayType
static SC_DLLPUBLIC OUString getDisplayedMeasureName(const OUString &rName, ScSubTotalFunc eFunc)
#define SAL_WARN(area, stream)
void GetGroupDimMemberIds(tools::Long nDim, std::vector< SCROW > &rIds) const
XclExpXmlPivotTables * GetTablesBySheet(SCTAB nTab)
virtual void SaveXml(XclExpXmlStream &rStrm) override
SC_DLLPUBLIC ScDPCache * getExistingCache(const ScRange &rRange)
ScRange GetOutputRangeByType(sal_Int32 nType)
OUString addRelation(const OUString &rType, std::u16string_view rTarget)
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
std::pair< bool, css::uno::Any > GetInteropGrabBagValue(const OUString &sName) const
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)